JBoss Community

Re: Can I get CallbackHandleObject on server side

created by Ron Sigal in JBoss Remoting - View the full discussion

Hi Dimitri,

 

The callbackHandleObject is used only on the client side.  Here's something you can try.  Instead of calling the Client method

 

   public void addListener(InvokerCallbackHandler callbackHandler,

                           InvokerLocator clientLocator, Object callbackHandlerObject);

 

use

 

   public void addListener(InvokerCallbackHandler callbackhandler, Map metadata,

                           Object callbackHandlerObject) throws Throwable;

 

and put some identifying information in the metadata map:

 

  HashMap metadata = new HashMap();

  metadata.put("key", "tag");

  client.addListener(..., metadata, ...);

 

Then on the server side, in your ServerInvocationHandler method

 

   public void addListener(InvokerCallbackHandler callbackHandler);

 

do something like

 

  ServerInvokerCallbackHandler serverInvokerCallbackHandler = (ServerInvokerCallbackHandler) callbackHandler;

  Client callbackClient = serverInvokerCallbackHandler.getCallbackClient();

  Map config = callbackClient.getConfiguration();

  String tag = config.get("key");

 

I haven't tested it, but it looks plausible.  By the way, thanks for the reference to that article.  I never heard of it before.

 

Good luck,

Ron

Reply to this message by going to Community

Start a new discussion in JBoss Remoting at Community