[jboss-dev-forums] [Design of EJB 3.0] - Re: EJBTHREE-1396 MockServer must report startup / shutdown

ALRubinger do-not-reply at jboss.com
Mon Nov 24 15:38:13 EST 2008


I'm actually surprised this works for you.

After launching the remote process, we need to wait a bit until it opens the command socket.  From my MockServerController.startServer():

      createRemoteProcess(processArgs);
  |       
  |       /* 
  |        * Wait a max of 5 seconds for the remote process to start
  |        */
  |       long start = System.currentTimeMillis();
  |       int timeoutIntervalSeconds = 5;
  |       long timeout = timeoutIntervalSeconds * 1000 + start;
  |       while (true)
  |       {
  |          try
  |          {
  |             // Start the server
  |             sendStartRequestToServer();
  |          }
  |          // Couldn't start server
  |          catch (CannotConnectException cce)
  |          {
  |             // If we haven't yet timed out
  |             long current = System.currentTimeMillis();
  |             if (current < timeout)
  |             {
  |                // Swallow exception and try again
  |                logger.trace("Can't connect to server @ " + current + ", trying until " + timeout);
  |                Thread.sleep(100);
  |                continue;
  |             }
  | 
  |             // Throw the exception, timeout's past
  |             throw cce;
  |          }
  |       }

Even after that, I'm getting CNFEs when the command to start the server is received:

15:26:01,003 ERROR [AbstractKernelController] Error installing to PreInstall: name=org.jboss.ejb3.JndiRegistrar.Session.SLSBJndiRegistrar state=Not Installed
  | java.lang.ClassNotFoundException: org.jboss.ejb3.proxy.jndiregistrar.JndiStatelessSessionRegistrar

...which is odd, I can see that the CP is getting set correctly to the remote process command:

/opt/sun/java/jdk1.5.0_15/bin/java -cp "/home/alrubinger/business/jboss/wc/jbossas/projects/ejb3/trunk/proxy/target/classes:...[etc]" -ea org.jboss.ejb3.test.proxy.remoteaccess.MockServer org.jboss.ejb3.test.proxy.remoteaccess.unit.RemoteAccessTestCase localhost 12345

Running this directly from the shell works just fine.

I'll have to look into this more later, probably after this week.  

Some other misc impressions to be elaborated upon later:

* MockServer isn't Thread-safe and there's some inconsistent synchronization when accessing its state, etc. 

* I neglected to provide facility for parent CLs in my Hack CLs that do the jndi.properties replacements. 

* Let's use Generics:

Map configParams = new HashMap();
  | configParams.put("timeout", String.valueOf(TIMEOUT));

* Make an SPI (expose publically) the value of the "timeout" String for the config params

* Always reset TCL to the original in a "finally" block.

S,
ALR

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

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



More information about the jboss-dev-forums mailing list