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

« back to all changes in this revision

Viewing changes to .pc/0001-convert-to-official-Java-concurrent-packages.patch/src/tests/org/jboss/test/remoting/performance/spring/rmi/SpringRMICallbackServerImpl.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.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 SpringRMICallbackServerImpl implements SpringRMICallbackServer
 
19
{
 
20
   private String sessionId;
 
21
   private Latch lock;
 
22
   private int numberOfCallsProcessed = 0;
 
23
   private int numberOfDuplicates = 0;
 
24
 
 
25
 
 
26
//   public SpringRMICallbackServerImpl(String sessionId, Latch lock)
 
27
//   {
 
28
//      this.sessionId = sessionId;
 
29
//      this.lock = lock;
 
30
//   }
 
31
 
 
32
   public void finishedProcessing(Object obj)
 
33
   {
 
34
      System.out.println("finishedProcessing called with " + obj);
 
35
      Callback callback = (Callback)obj;
 
36
      try
 
37
      {
 
38
         handleCallback(callback);
 
39
      }
 
40
      catch(HandleCallbackException e)
 
41
      {
 
42
         e.printStackTrace();
 
43
      }
 
44
   }
 
45
 
 
46
   public void setClientSessionId(String clientSessionId)
 
47
   {
 
48
      this.sessionId = clientSessionId;
 
49
   }
 
50
 
 
51
   public void setServerDoneLock(Latch serverDoneLock)
 
52
   {
 
53
      this.lock = serverDoneLock;
 
54
   }
 
55
 
 
56
   public int getNumberOfCallsProcessed()
 
57
   {
 
58
      return numberOfCallsProcessed;
 
59
   }
 
60
 
 
61
   public int getNumberOfDuplicates()
 
62
   {
 
63
      return numberOfDuplicates;
 
64
   }
 
65
 
 
66
   public void handleCallback(Callback callback) throws HandleCallbackException
 
67
   {
 
68
      Object ret = callback.getCallbackObject();
 
69
      Integer[] handledArray = (Integer[])ret;
 
70
      Integer numOfCallsHandled = (Integer) handledArray[0];
 
71
      Integer numOfDuplicates = (Integer) handledArray[1];
 
72
      System.out.println("Server is done.  Number of calls handled: " + numOfCallsHandled);
 
73
      numberOfCallsProcessed = numOfCallsHandled.intValue();
 
74
      System.out.println("Number of duplicate calls: " + numOfDuplicates);
 
75
      numberOfDuplicates = numOfDuplicates.intValue();
 
76
      Object obj = callback.getCallbackHandleObject();
 
77
      //String handbackObj = (String) obj;
 
78
      //System.out.println("Handback object should be " + sessionId + " and server called back with " + handbackObj);
 
79
      lock.release();
 
80
 
 
81
   }
 
82
 
 
83
}
 
 
b'\\ No newline at end of file'