Control remote clients status on TCP connections

2019-08-20 05:08发布

问题:

I need to write a platform with a centralized server and a lot of remote clients to execute tasks. I'm currently using an RMI connection, being the centralized server who acts as client of the remote clients (RMI servers). It's working, but I'm afraid of have a lot of problems in a near future (is a good idea to use RMI?) so I'm thinking in move the code to SSLSockets and send serialized classes to do the same.

My problem with this approach y how to control the list of active clients. I need to have connection data to send tasks and I need to know if they are alive. Any idea?

Thanks in advance for your help.

回答1:

There is no such thing as an 'RMI connection', but you can accomplish what you want via the RMI Remote Session pattern (Google it) plus implementing the Unreferenced interface on the remote session objects, which will tell you when the client is no longer current, if they haven't already called the session logout method, if you provide it.

See this answer for details of the Remote Session pattern.



标签: java ssl rmi jsse