~ubuntu-branches/ubuntu/wily/libjboss-remoting-java/wily

« back to all changes in this revision

Viewing changes to tests/org/jboss/test/remoting/performance/spring/rmi/SpringRMIServerImpl.java

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-09 14:01:03 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: package-import@ubuntu.com-20110909140103-hqokx61534tas9rg
Tags: 2.5.3.SP1-1
* Newer but not newest upstream release. Do not build samples.
* Change debian/watch to upstream's svn repo.
* Add patch to fix compile error caused by tomcat update.
  (Closes: #628303)
* Switch to source format 3.0.
* Switch to debhelper level 7.
* Remove useless Depends.
* Update Standards-Version: 3.9.2.
* Update README.source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************
2
 
 *                                     *
3
 
 *  JBoss: The OpenSource J2EE WebOS   *
4
 
 *                                     *
5
 
 *  Distributable under LGPL license.  *
6
 
 *  See terms of license at gnu.org.   *
7
 
 *                                     *
8
 
 ***************************************/
9
 
package org.jboss.test.remoting.performance.spring.rmi;
10
 
 
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;
14
 
 
15
 
import java.util.Map;
16
 
 
17
 
/**
18
 
 * @author <a href="mailto:tom@jboss.org">Tom Elrod</a>
19
 
 */
20
 
public class SpringRMIServerImpl implements SpringRMIServer
21
 
{
22
 
   private Map callTrackers = new ConcurrentHashMap();
23
 
 
24
 
   public Object sendNumberOfCalls(Object obj, Object param)
25
 
   {
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);
32
 
      if (tracker != null)
33
 
      {
34
 
         tracker.createTotalCount(totalCount);
35
 
      }
36
 
      else
37
 
      {
38
 
         SpringRMIHandler callbackHandler = new SpringRMIHandler(sessionId);
39
 
         callbackHandler.start();
40
 
         tracker = new CallTracker(sessionId, callbackHandler);
41
 
         callTrackers.put(sessionId, tracker);
42
 
         tracker.createTotalCount(totalCount);
43
 
      }
44
 
      return totalCountInteger;
45
 
   }
46
 
 
47
 
   public Object makeCall(Object obj, Object param)
48
 
   {
49
 
      Payload payload = (Payload) param;
50
 
      int clientInvokeCallCount = payload.getCallNumber();
51
 
 
52
 
      String sessionId = (String) obj;
53
 
      CallTracker tracker = (CallTracker) callTrackers.get(sessionId);
54
 
      if (tracker != null)
55
 
      {
56
 
         tracker.verifyClientInvokeCount(clientInvokeCallCount);
57
 
      }
58
 
      else
59
 
      {
60
 
         System.err.println("No call tracker exists for session id " + sessionId);
61
 
         throw new RuntimeException("No call tracker exists for session id " + sessionId);
62
 
      }
63
 
 
64
 
      return new Integer(clientInvokeCallCount);
65
 
   }
66
 
 
67
 
}
 
 
b'\\ No newline at end of file'