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

jaikiran do-not-reply at jboss.com
Sat Dec 13 06:36:01 EST 2008


"ALRubinger" wrote : 
  | 
  | 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
  | 

I could reproduce this on my local system (RHEL 5 OS). The issue is because of this change that i did to support Windows platform (my earlier setup) http://www.jboss.com/index.html?module=bb&op=viewtopic&t=145100&postdays=0&postorder=asc&start=0#4187002

Since we are using the ProcessBuilder to start a Java process, the double quotes at the beginning and the end of the -cp classpath are being passed to Java which seems to not like them on *nix platform.

"ALRubinger" wrote : 
  | Running this directly from the shell works just fine.
  | 
Since the shell takes care of removing the double quotes before passing on the parameters to Java, it works from shell.

I'll undo the double quotes change and introduce a better way to take care of any space in the classpath.


"ALRubinger" wrote : 
  | * MockServer isn't Thread-safe and there's some inconsistent synchronization when accessing its state, etc. 
  | 
Moved the piece of code accessing the state, into the synchronized block. Was there anything else which you think is incorrectly synchronized?

  | /**
  |     * On receiving a {@link MockServerRequest} the invocation handler will
  |     * carry out appropriate operation on the {@link MockServer} <br>
  |     * 
  |     * Supported requests are <br/>
  |     * <li>
  |     *   <ul>
  |     *   {@link MockServerRequest.START} - On receiving this request, the invocation 
  |     *   handler will start the {@link MockServer}
  |     *   </ul>
  |     *   <ul>
  |     *   {@link MockServerRequest.STOP} - On receiving this request, the invocation 
  |     *   handler will stop the {@link MockServer}
  |     *   </ul>
  |     * </li>
  |     * @throws {@link IllegalArgumentException} If the <code>invocationRequest</code>
  |     *           is not supported
  |     * @see org.jboss.remoting.ServerInvocationHandler#invoke(org.jboss.remoting.InvocationRequest)
  |     */
  |    public Object invoke(InvocationRequest invocationRequest) throws Throwable
  |    {
  | 
  |  ..... 
  |       // The same invocation handler can be called by multiple threads.
  |       synchronized (this.mockServer)
  |       {
  |          if (request.equals(MockServerRequest.START))
  |          {
  |             this.mockServer.start();
  |          }
  |          else if (request.equals(MockServerRequest.STOP))
  |          {
  |             this.mockServer.stop();
  |             
  |          }
  |          else
  |          {
  |             throw new IllegalArgumentException("Unrecognized request " + invocationRequest.getParameter());
  |          }
  |          return mockServer.getStatus();
  |       }
  | 
  |       
  |    }


"ALRubinger" wrote : 
  | * Let's use Generics:
  | 
Done.

"ALRubinger" wrote : 
  | * Make an SPI (expose publically) the value of the "timeout" String for the config params
  | 
The MockServerController now has 

  |   /**
  |     * Sets the timeout for the server startup.
  |     * <br/>
  |     * This method has to be called before calling the {@link #startServer(String[])} method,
  |     * for the timeout to be considered.
  |     * 
  |     * @param timeout The timeout value in milli seconds.
  |     */
  |    public void setServerStartupTimeout(int timeout)
  |    {
  |   	// code
  |    }
  | 
  |    /**
  |     * Returns the timeout set for the server startup.
  |     * 
  |     * @return
  |     */
  |    public int getServerStartupTimeout()
  |    {
  |       // ...
  |    }
  |    
  |    /**
  |     * Returns the timeout set for server to stop
  |     * 
  |     * @return
  |     */
  |    public int getServerStopTimeout()
  |    {
  |       // ...
  |    }
  | 
  |    /**
  |     * Sets the timeout for the server to stop.
  |     * <br/>
  |     * This method has to be called before calling the {@link #stopServer()} method,
  |     * for the timeout to be considered.
  |     * 
  |     * @param timeout The timeout value in milli seconds.
  |     */
  |    public void setServerStopTimeout(int timeout)
  |    {
  |       // ...
  |    }




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

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



More information about the jboss-dev-forums mailing list