Manage client and server identities
This topic has not yet been written. The content below is from the topic description.
Client and server identities Note that by default, a LeasePinger has no identity, so if it is replaced by another LeasePinger that pings the same Lease, the connection remains unchanged. Suppose that leasing is enabled and that a RemoteClientInvoker stops and is replaced by a new RemoteClientInvoker with a new LeasePinger. If the replacement occurs quickly, the server side Lease may never miss a PING, in which case there is no evidence that anything changed on the client side. That is, the connection is still alive, as far as the server is concerned. That semantics might be perfectly acceptable for some applications, but other applications might interpret the same events as a connection failure followed by a new connection. In particular, JBoss Messaging needs the latter semantics. As of release 2.5.2, an important concept related to connection monitoring, client connection identity, is available. Remoting can be configured to treat a connection as being defined by a LeasePinger/Lease pair in which the LeasePinger has an identity. More specifically, when configured to do so by setting the parameter useClientConnectionIdentity to "true", Remoting identifies a connection with a LeasePinger/Lease pair in which the Lease expects PINGs to arrive from a particular LeasePinger. A Client participates in a connection when it is connected by way of the new method public void connect(ConnectionListener listener, Map metadata) throws Exception; This method serves to connect the Client to the server by way of a new or existing RemoteClientInvoker, and it also registers the new ConnectionValidator with the RemoteClientInvoker's LeasePinger. Subsequently, if any ConnectionValidator registered with that LeasePinger detects a connection failure, it will (if "stopLeaseOnFailure" is "true") stop the LeasePinger, and the LeasePinger will cause each registered ConnectionValidator to notify each of its registered ConnectionListeners of the connection failure. Once the LeasePinger has been shut down and all of the notifications have been made, the connection anchored by the LeasePinger is defunct, and the associated Clients should be disconnected by a call to Client.disconnect(). If such a Client is reconnected by a call to Client.connect(), it will be associated with a new LeasePinger and, therefore, a new connection. As of release 2.5.3.SP2, Remoting also supports the concept of server connection identity. Suppose that a ServerInvoker managing a Lease stops and is replaced by a new ServerInvoker and Lease. If the replacement occurs between PINGs from a ConnectionValidator, there is no evidence that the server has been replaced. Again, that semantics might be appropriate for some applications, but JBoss Messaging needs a semantics in which the original connection is considered to have been destroyed and replaced. If the parameter useServerConnectionIdentity is set to "true", then, when a ServerInvoker responds to a PING from a ConnectionValidator, it returns a token of its unique identity. If the identity has changed, then ConnectionValidator considers the connection to have been broken and it notifies all registered listeners.