1 Reply Latest reply on Feb 3, 2006 3:35 PM by Tom Elrod

    MBean as a Listener

    Vassil Kriakov Newbie

      I have a weird problem. I have an MBean in JBoss AS. This MBean connects to a server and receives data from the server. The server _pushes_ the data to the MBean as soon as it arrives.

      Thus, the MBean acts as a client by creating a local Connector (callback server), which acts as the local server accepting the pushed data. Then the MBean creates a Client which connects to the remote server, and adds a listener on the callback servers' invoker locator.

      My problem is that even when I stop the MBean, the callback server (Connector) and the client (Client), I continue to receive data from the remote server.

      Here is how I connect to the server (sans catch/try):
      callbackServerURI = "socket://" + localhost + ":" + port;
      callbackServer = new Connector();
      callbackServer.getServerInvoker().addInvocationHandler("S1", new DataProviderServerInvocationHelper());

      client = new Client( new InvokerLocator(serverLocatorURI), "S1");
      listener = new DataProviderCallbackHandlerImpl();
      client.addListener(listener, new InvokerLocator(callbackServerURI));

      Here is how I disconnect:

      The variables listener, callbackServer, and client a stored in the MBean. Is there anything wrong with this configuration? Why doesn't the client disconnect at the end (the local socket is also not freed up)?

      I'll be very greatful for your help.

        • 1. Re: MBean as a Listener
          Tom Elrod Master

          First off am not sure why you are not seeing an exception when making the following call:


          Upon making this call on the client, the client will remove the listener from the callback server and the target server. Since the callback server has been destroyed, should get a org.jboss.remoting.CannotConnectException thrown.

          Just to make sure there wasn't a bug with disconnecting callbacks, I wrote a test case to verify that once callback listener is removed and the callback server is destroyed, that no more callbacks are delivered (based off the code you posted in the forum).

          The test classes are org.jboss.test.remoting.callback.push.disconnect.CallbackTestClient and org.jboss.test.remoting.callback.push.disconnect.CallbackTestServer.

          The test passes on my machine with latest remoting codebase. Also, was able to debug to make sure that there were no threads left over that shouldn't be and there were not.

          If you still think this is an issue, please open a jira issue and supply a test case demonstrating the bug.