KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > wsdl > session > SessionTestSoapBindingImpl


1 /**
2  * SessionTestSoapBindingImpl.java
3  *
4  * This file was auto-generated from WSDL
5  * by the Apache Axis WSDL2Java emitter.
6  */

7 package test.wsdl.session;
8
9 /**
10  * Class SessionTestSoapBindingImpl
11  */

12 public class SessionTestSoapBindingImpl
13         implements test.wsdl.session.SessionTestServer {
14
15     /**
16      * Method doSomething
17      *
18      * @return
19      *
20      * @throws java.rmi.RemoteException
21      */

22     public boolean doSomething() throws java.rmi.RemoteException JavaDoc {
23
24         // if this is my session only then the data will be 0
25
boolean succeeded = true;
26         int count = countUp();
27
28         if (count != 1) {
29             System.out.println("Failed with count=" + count);
30             succeeded = false;
31         }
32         try {
33             // simulate some busy processing
34
Thread.currentThread().sleep(999);
35         } catch (InterruptedException JavaDoc e) {
36             // ignore
37
}
38
39         // check exit count
40
count = countDown();
41         if (count != 0) {
42             System.out.println("Failed with count=" + count);
43             succeeded = false;
44         }
45         return succeeded;
46     }
47
48     /**
49      * Count one caller
50      *
51      * @return Number of simultaneous session callers.
52      */

53     private synchronized int countUp() {
54         sessionCallers++;
55         return sessionCallers;
56     }
57
58     /**
59      * Count down one caller
60      *
61      * @return Number of callers left.
62      */

63     private synchronized int countDown() {
64         sessionCallers--;
65         return sessionCallers;
66     }
67
68     /** count simultaneous session callers */
69     private int sessionCallers = 0;
70 }
71
Popular Tags