~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/http/client/SpringHttpCallbackServerImpl.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.http.client;
10
 
 
11
 
import EDU.oswego.cs.dl.util.concurrent.Latch;
12
 
import org.jboss.remoting.callback.Callback;
13
 
import org.jboss.remoting.callback.HandleCallbackException;
14
 
 
15
 
/**
16
 
 * @author <a href="mailto:tom@jboss.org">Tom Elrod</a>
17
 
 */
18
 
public class SpringHttpCallbackServerImpl implements SpringHttpCallbackServer
19
 
{
20
 
   private String sessionId;
21
 
   private Latch lock;
22
 
   private int numberOfCallsProcessed = 0;
23
 
   private int numberOfDuplicates = 0;
24
 
 
25
 
 
26
 
   public void finishedProcessing(Object obj)
27
 
   {
28
 
      System.out.println("finishedProcessing called with " + obj);
29
 
      Callback callback = (Callback)obj;
30
 
      try
31
 
      {
32
 
         handleCallback(callback);
33
 
      }
34
 
      catch(HandleCallbackException e)
35
 
      {
36
 
         e.printStackTrace();
37
 
      }
38
 
   }
39
 
 
40
 
   public void setClientSessionId(String clientSessionId)
41
 
   {
42
 
      this.sessionId = clientSessionId;
43
 
   }
44
 
 
45
 
   public void setServerDoneLock(Latch serverDoneLock)
46
 
   {
47
 
      this.lock = serverDoneLock;
48
 
   }
49
 
 
50
 
   public int getNumberOfCallsProcessed()
51
 
   {
52
 
      return numberOfCallsProcessed;
53
 
   }
54
 
 
55
 
   public int getNumberOfDuplicates()
56
 
   {
57
 
      return numberOfDuplicates;
58
 
   }
59
 
 
60
 
   public void handleCallback(Callback callback) throws HandleCallbackException
61
 
   {
62
 
      Object ret = callback.getCallbackObject();
63
 
      Integer[] handledArray = (Integer[])ret;
64
 
      Integer numOfCallsHandled = (Integer) handledArray[0];
65
 
      Integer numOfDuplicates = (Integer) handledArray[1];
66
 
      System.out.println("Server is done.  Number of calls handled: " + numOfCallsHandled);
67
 
      numberOfCallsProcessed = numOfCallsHandled.intValue();
68
 
      System.out.println("Number of duplicate calls: " + numOfDuplicates);
69
 
      numberOfDuplicates = numOfDuplicates.intValue();
70
 
      Object obj = callback.getCallbackHandleObject();
71
 
      //String handbackObj = (String) obj;
72
 
      //System.out.println("Handback object should be " + sessionId + " and server called back with " + handbackObj);
73
 
      lock.release();
74
 
 
75
 
   }
76
 
 
77
 
}