[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/performance/spring/rmi ...
Ron Sigal
ron_sigal at yahoo.com
Sun Sep 3 01:46:33 EDT 2006
User: rsigal
Date: 06/09/03 01:46:33
Modified: src/tests/org/jboss/test/remoting/performance/spring/rmi
MultiThreadedSpringRMIPerformanceClient.java
Log:
JBREM-592: Duplicated changes in addCallbackListener() made to SpringRMIPerformanceClient - ApplicationContext is created in a loop and the callback server is exported programmatically.
Revision Changes Path
1.2 +50 -1 JBossRemoting/src/tests/org/jboss/test/remoting/performance/spring/rmi/MultiThreadedSpringRMIPerformanceClient.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MultiThreadedSpringRMIPerformanceClient.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/tests/org/jboss/test/remoting/performance/spring/rmi/MultiThreadedSpringRMIPerformanceClient.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- MultiThreadedSpringRMIPerformanceClient.java 13 Aug 2006 19:30:05 -0000 1.1
+++ MultiThreadedSpringRMIPerformanceClient.java 3 Sep 2006 05:46:33 -0000 1.2
@@ -21,6 +21,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;
@@ -94,10 +95,58 @@
{
String springServiceXml = this.getClass().getResource("SpringRMIClientService.xml").getFile();
- ApplicationContext context = new FileSystemXmlApplicationContext(springServiceXml);
+// 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);
+ }
+ }
+
SpringRMICallbackServer callbackServer = (SpringRMICallbackServer) context.getBean("springRMICallbackServerService");
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="SpringRMICallbackServerService"/>
+ <property name="service" ref="springRMICallbackServerService"/>
+ <!--<property name="servicePort" value="1300"/>-->
+ <property name="serviceInterface" value="org.jboss.test.remoting.performance.spring.rmi.SpringRMICallbackServer"/>
+ <property name="registryPort" value="1299"/>
+ </bean>
+*/
+ for (int i = 0; i < 10; i++)
+ {
+ try
+ {
+ RmiServiceExporter exporter = new RmiServiceExporter();
+ exporter.setServiceName("SpringRMICallbackServerService:" + clientSessionId);
+ exporter.setService(callbackServer);
+ exporter.setServiceInterface(org.jboss.test.remoting.performance.spring.rmi.SpringRMICallbackServer.class);
+ exporter.setRegistryPort(1299);
+ exporter.afterPropertiesSet();
+ log.info("exported SpringRMICallbackServerService:" + 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