File: SessionTestSoapBindingImpl.java

package info (click to toggle)
axis 1.4-29
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 52,100 kB
  • sloc: java: 129,124; xml: 10,602; jsp: 983; sh: 84; cs: 36; makefile: 18
file content (70 lines) | stat: -rw-r--r-- 1,635 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
 * SessionTestSoapBindingImpl.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis WSDL2Java emitter.
 */
package test.wsdl.session;

/**
 * Class SessionTestSoapBindingImpl
 */
public class SessionTestSoapBindingImpl
        implements test.wsdl.session.SessionTestServer {

    /**
     * Method doSomething
     *
     * @return
     *
     * @throws java.rmi.RemoteException
     */
    public boolean doSomething() throws java.rmi.RemoteException {

        // if this is my session only then the data will be 0
        boolean succeeded = true;
        int count = countUp();

        if (count != 1) {
            System.out.println("Failed with count=" + count);
            succeeded = false;
        }
        try {
            // simulate some busy processing
            Thread.currentThread().sleep(999);
        } catch (InterruptedException e) {
            // ignore
        }

        // check exit count
        count = countDown();
        if (count != 0) {
            System.out.println("Failed with count=" + count);
            succeeded = false;
        }
        return succeeded;
    }

    /**
     * Count one caller
     *
     * @return Number of simultaneous session callers.
     */
    private synchronized int countUp() {
        sessionCallers++;
        return sessionCallers;
    }

    /**
     * Count down one caller
     *
     * @return Number of callers left.
     */
    private synchronized int countDown() {
        sessionCallers--;
        return sessionCallers;
    }

    /** count simultaneous session callers           */
    private int sessionCallers = 0;
}