How a server can make a session with a client in RMI

后端 未结 1 1190
别那么骄傲
别那么骄傲 2020-11-28 14:47

I want someone to tell me where to search for how to make a session between the client(s) and the server in RMI, i.e what is the name of that concept for searching purposes?

相关标签:
1条回答
  • 2020-11-28 15:25

    I named this the Remote Session pattern in my 2001 book.

    The idea is to have a singleton RMI object, bound in the Registry, with nothing but a login() method. That method, if successful, returns a new RemoteSession object for every call, that contains the API you need for the session. RemoteSession is another remote interface of course. It also contains a logout() method, which unexports the object, and it also implements Unreferenced, as another way of terminating the session.

    Each instance of RemoteSession can maintain client state, so it is a session object, and as the only way to get a RemoteSession object is via login(), it is secure to a first approximation.

    0 讨论(0)
提交回复
热议问题