[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/performance/spring/http/client ...

Ron Sigal rsigal at belmont.prod.atl2.jboss.com
Wed Aug 30 21:20:28 EDT 2006


  User: rsigal  
  Date: 06/08/30 21:20:28

  Modified:    src/tests/org/jboss/test/remoting/performance/spring/http/client 
                        SpringHttpPerformanceClient.java
  Log:
  JBREM-595:  Registration of callback server with rmi registry is now done programmatically.
  
  Revision  Changes    Path
  1.2       +55 -1     JBossRemoting/src/tests/org/jboss/test/remoting/performance/spring/http/client/SpringHttpPerformanceClient.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SpringHttpPerformanceClient.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/tests/org/jboss/test/remoting/performance/spring/http/client/SpringHttpPerformanceClient.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- SpringHttpPerformanceClient.java	14 Aug 2006 22:06:34 -0000	1.1
  +++ SpringHttpPerformanceClient.java	31 Aug 2006 01:20:28 -0000	1.2
  @@ -22,6 +22,7 @@
   import org.springframework.context.support.FileSystemXmlApplicationContext;
   import org.springframework.core.io.ClassPathResource;
   import org.springframework.core.io.Resource;
  +import org.springframework.remoting.rmi.RmiServiceExporter;
   
   import java.rmi.server.UID;
   import java.util.Map;
  @@ -95,10 +96,63 @@
      {
         String springServiceXml = this.getClass().getResource("SpringHttpClientService.xml").getFile();
   
  -      ApplicationContext context = new FileSystemXmlApplicationContext(springServiceXml);
  +      ApplicationContext context = null;
  +      for (int i = 0; i < 10; i++)
  +      {
  +         try
  +         {
  +            context = new FileSystemXmlApplicationContext(springServiceXml);
  +            if (context != null)
  +               break;
  +         }
  +         catch (Exception e)
  +         {
  +            Thread.sleep(2000);
  +         }
  +      }
  +      
  +      if (context == null)
  +      {
  +         log.error("unable to create FileSystemXmlApplicationContext from SpringHttpClientService.xml");
  +         throw new Exception("unable to create FileSystemXmlApplicationContext from SpringHttpClientService.xml");
  +      }
  +      
         SpringHttpCallbackServer callbackServer = (SpringHttpCallbackServer) context.getBean("springHttpCallbackServerService");
         callbackServer.setClientSessionId(clientSessionId);
         callbackServer.setServerDoneLock(serverDoneLock);
  +      
  +/*
  +      Instead of exporting callback servers by injection, the following xml declaration is
  +      carried out programmatically.  Each callback server is registered under a name
  +      ending in the sessionId.
  +    
  +   <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
  +      <property name="serviceName" value="SpringHttpCallbackServerService"/>
  +      <property name="service" ref="springHttpCallbackServerService"/>
  +      <property name="servicePort" value="1300"/>
  +      <property name="serviceInterface" value="org.jboss.test.remoting.performance.spring.http.client.SpringHttpCallbackServer"/>
  +      <property name="registryPort" value="1299"/>
  +   </bean> 
  +*/
  +      for (int i = 0; i < 10; i++)
  +      {
  +         try
  +         {
  +            RmiServiceExporter exporter = new RmiServiceExporter();
  +            exporter.setServiceName("SpringHttpCallbackServerService:" + clientSessionId);
  +            exporter.setService(callbackServer);
  +            exporter.setServiceInterface(org.jboss.test.remoting.performance.spring.http.client.SpringHttpCallbackServer.class);
  +            exporter.setRegistryPort(1299);
  +            exporter.afterPropertiesSet();
  +            log.info("exported SpringHttpCallbackServerService:" + clientSessionId);
  +            break;
  +         }
  +         catch (Exception e)
  +         {
  +            Thread.sleep(2000);
  +         }
  +      }
  +      
         return callbackServer;
   
   //      RMICallbackServer callbackServer = new RMICallbackServer(clientSessionId, serverDoneLock);
  
  
  



More information about the jboss-cvs-commits mailing list