2 Replies Latest reply on Apr 30, 2007 10:48 AM by bord

    transporter sample fails when run a second time

    bord

      i changed the transporter sample client to run any number of iterations of the makeClientCall and i find that the 2nd iteration gives a failed assertion
      assertNotNull(processedCustomer);

      meaning that the processedCustomer is null.

      The server program has an exception indicating "socket in use".

      org.jboss.remoting.InvalidConfigurationException: The invoker for locator (Invok
      erLocator [socket://10.104.30.186:5433/]) is already in use by another Connector
      . Either change the locator or add new handlers to existing Connector.
      at org.jboss.remoting.InvokerRegistry.createServerInvoker(InvokerRegistr
      y.java:520)

      Now i thought that maybe adding a new method
      public void releaseCustomer(ICustomer customerProxy)
      to the CustomerProcessor interface could be used to stop the transporterServer running on the server so as to fix the issue.
      i tried hacking this up and cannot get it to work due to issues with the TransporterClient for customerProcessor.

      In other words this one did not work for releaseCustomer

      int id = customerProxy.getCustomerId(); TransporterClient.destroyTransporterClient(customerProxy); ((TransporterServer)cust2server.remove(id)).stop();

      where the cust2server is a Map and this one

      cust2server.put(customer.getCustomerId(), server);

      was added to the processCustomer.

      what i get with above is an exception back at the client (on 3rd iteration) with this cause.

      Caused by: org.jboss.remoting.ServerInvoker$InvalidStateException: Can not proc
      ess invocation request since is not in started state.
      at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:751)
      at org.jboss.remoting.transport.socket.ServerThread.processInvocation(S
      erverThread.java:553)
      at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.
      java:377)
      at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.ja
      va:159)
      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClient
      Invoker.java:163)
      at org.jboss.remoting.Client.invoke(Client.java:1548)
      at org.jboss.remoting.Client.invoke(Client.java:534)
      at org.jboss.remoting.Client.invoke(Client.java:522)
      at org.jboss.remoting.transporter.TransporterClient.invoke(TransporterC
      lient.java:297)

      ---------------------

      After some studying of the code i believe the InvokerRegistry has ref count of 2 for the ClientInvoker at the time of the destroyClientInvoker.

      And thus never really cleaned up the ClientInvoker completely yet this residual ClientInvoker seemed not to get its serverInvoker set when a new serverInvoker was created.

      Well i'm awfully confused with what should be done
      with this sample if not whether there should be some fixes in the remoting so that InvokerRegistries can zero out the count of a ClientInvoker when need be.

      anyone?

      craig




        • 1. Re: transporter sample fails when run a second time
          ron_sigal

          Hi,

          Which version of the transporter sample code are you using? I just changed org.jboss.remoting.samples.transporter.basic.client.Client.main() to make two calls to client.makeClientCall() and it works fine.

          The message

          The invoker for locator (InvokerLocator [socket://10.104.30.186:5433/]) is already in use by another Connector.


          means that a Connector for socket://10.104.30:186:5433 is running and you've tried to start a second Connector for the same InvokerLocator in the same JVM. E.g., when I change org.jboss.remoting.samples.transporter.basic.server.Server.start() to

           public void start() throws Exception
           {
           server = TransporterServer.createTransporterServer(locatorURI, new CustomerProcessorImpl(), CustomerProcessor.class.getName());
           server = TransporterServer.createTransporterServer(locatorURI, new CustomerProcessorImpl(), CustomerProcessor.class.getName());
           }
          


          I get that message.

          • 2. Re: transporter sample fails when run a second time
            bord

            Hi
            To the question of which version i'm using. Answer is 2.2 GA that i downloaded a couple weeks back.
            Again when I change the client to make two calls it gives me this after first call succeeds:

            Exception in thread "main" junit.framework.AssertionFailedError: null
            at junit.framework.Assert.fail(Assert.java:47)
            at junit.framework.Assert.assertTrue(Assert.java:20)
            at junit.framework.Assert.assertNotNull(Assert.java:214)
            at junit.framework.Assert.assertNotNull(Assert.java:207)
            at proxy.Client.testClientCall(Client.java:32)
            at proxy.Client.main(Client.java:119)


            and this makes sense because as you found the Server.java would not allow a second createTransporterServer.

            To me this whole example is faulty. I'd like to see the proper destroyTransporterServer called on the Customer object that the server creates so as to allow repeated Customer objects to get created.
            As i have indicated I have tried to make this work but have not been successful.
            thanks all.