Debian Codegraph @

test/wsdl/session/SessionTestSoapBindingImpl.java

raw
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 {
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 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 }