1
/***************************************
3
* JBoss: The OpenSource J2EE WebOS *
5
* Distributable under LGPL license. *
6
* See terms of license at gnu.org. *
8
***************************************/
9
package org.jboss.test.remoting.performance.spring.rmi;
11
import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
12
import org.jboss.test.remoting.performance.synchronous.CallTracker;
13
import org.jboss.test.remoting.performance.synchronous.Payload;
18
* @author <a href="mailto:tom@jboss.org">Tom Elrod</a>
20
public class SpringRMIServerImpl implements SpringRMIServer
22
private Map callTrackers = new ConcurrentHashMap();
24
public Object sendNumberOfCalls(Object obj, Object param)
26
System.out.println("sent number of calls " + obj + " " + param);
27
String sessionId = (String) obj;
28
Integer totalCountInteger = (Integer) param;
29
int totalCount = totalCountInteger.intValue();
30
System.out.println("received totalCallCount call with total count of " + totalCount + " from " + sessionId);
31
CallTracker tracker = (CallTracker) callTrackers.get(sessionId);
34
tracker.createTotalCount(totalCount);
38
SpringRMIHandler callbackHandler = new SpringRMIHandler(sessionId);
39
callbackHandler.start();
40
tracker = new CallTracker(sessionId, callbackHandler);
41
callTrackers.put(sessionId, tracker);
42
tracker.createTotalCount(totalCount);
44
return totalCountInteger;
47
public Object makeCall(Object obj, Object param)
49
Payload payload = (Payload) param;
50
int clientInvokeCallCount = payload.getCallNumber();
52
String sessionId = (String) obj;
53
CallTracker tracker = (CallTracker) callTrackers.get(sessionId);
56
tracker.verifyClientInvokeCount(clientInvokeCallCount);
60
System.err.println("No call tracker exists for session id " + sessionId);
61
throw new RuntimeException("No call tracker exists for session id " + sessionId);
64
return new Integer(clientInvokeCallCount);
b'\\ No newline at end of file'