[jboss-user] [Remoting] - Re: Callback Questions

ron.sigal@jboss.com do-not-reply at jboss.com
Fri Mar 2 00:30:12 EST 2007


anonymous wrote : 
  | 1. When the server sends callbacks to the client, are the callbacks delivered in the same order they have been sent? 

1. Pull callbacks are retrieved in the order that the ServerInvocationHandler passes them by way of InvokerCallbackHandler.handleCallback().

2. The situation for push callbacks is somewhat more complicated and transport specific.  When the ServerInvocationHandler calls InvokerCallbackHandler.handleCallback() for a push callback, a client invoker  on the server side makes an invocation on the callback server invoker on the client side.  If callback A is generated and then callback B is generated a second later, it's very likely that callback A will arrive before callback B.  However, there may be some nondeterminism according to the transport and its configuration.  The client invoker of the socket transport (and its descendants) maintains a connection pool, and if callbacks A and B are generated in quick succession, it is possible for them to go out over two different connections and for callback B to arrive before callback A.  

If you need to preserve determinism, you can configure the connection pool to have no more than one connection by setting org.jboss.remoting.transport.MicroSocketClientInvoker.MAX_POOL_SIZE_FLAG to "1" in the Client's configuration map.  

There's also a new, and as yet undocumented, facility for registering a listener which will receive acknowledgements that callbacks have been delivered, and that could be used, at the cost of some latency, to serialize the delivery of callbacks.  I need to write that documentation in the next few days, and when it's done I'll post a pointer to it.

anonymous wrote : 
  | Is possible to pass the identifier to the server when registering the client's callbackhandler? 

In the interest of completeness I should say that the phrase "the client's callbackhandler" is somewhat ambiguous.  (1)  A single callback handler could be passed to multiple Clients. (2) Some versions of Client.addListener() create a callback Connector as a convenience.  If a single callback handler is passed to one of these methods on the same Client, it will appear on the server side to be two callback handler instances.

Let's assume, though, that you have a one-one relationship between callback handlers and Clients.  Each client is endowed with a unique session ID when it is created, and each callback handler that is passed to an addListener() method of Client A is given the session ID of Client A.  That session ID can be retrieved on the server side by casting to ServerInvokerCallbackHandler the InvokerCallbackHandler passed in to ServerInvocationHandler.addListener() and calling getClientSessionId() on it.  For more information, see the thread


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024543#4024543

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024543

More information about the jboss-user mailing list