litesoft
Diff Revisions
949
vs
950
for /trunk/Java/GWT/OldServer/src/org/litesoft/GWT/eventbus/server/nonpublic/ProcessingManagerServerImpl.java
|
@@ -1,30 +1,30 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.eventbus.server.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.eventbus.client.nonpublic.*; |
5 |
|
- |
|
6 |
|
- |
public class ProcessingManagerServerImpl implements IProcessingManager { |
7 |
|
- |
private int mThreads = 0; |
8 |
|
- |
|
9 |
|
- |
public synchronized void waitTillNoOthers() { |
10 |
|
- |
while ( mThreads != 0 ) { |
11 |
|
- |
try { |
12 |
|
- |
wait(); |
13 |
|
- |
} |
14 |
|
- |
catch ( InterruptedException e ) { |
15 |
|
- |
// Whatever... |
16 |
|
- |
} |
17 |
|
- |
} |
18 |
|
- |
} |
19 |
|
- |
|
20 |
|
- |
public synchronized boolean incThreadsAndIndicateIfWeAreFirst() { |
21 |
|
- |
boolean rv = (mThreads == 0); |
22 |
|
- |
mThreads++; |
23 |
|
- |
return rv; |
24 |
|
- |
} |
25 |
|
- |
|
26 |
|
- |
public synchronized void decThreads() { |
27 |
|
- |
mThreads--; |
28 |
|
- |
notifyAll(); |
29 |
|
- |
} |
30 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.eventbus.server.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.eventbus.client.nonpublic.*; |
|
5 |
+ |
|
|
6 |
+ |
public class ProcessingManagerServerImpl implements IProcessingManager { |
|
7 |
+ |
private int mThreads = 0; |
|
8 |
+ |
|
|
9 |
+ |
public synchronized void waitTillNoOthers() { |
|
10 |
+ |
while ( mThreads != 0 ) { |
|
11 |
+ |
try { |
|
12 |
+ |
wait(); |
|
13 |
+ |
} |
|
14 |
+ |
catch ( InterruptedException e ) { |
|
15 |
+ |
// Whatever... |
|
16 |
+ |
} |
|
17 |
+ |
} |
|
18 |
+ |
} |
|
19 |
+ |
|
|
20 |
+ |
public synchronized boolean incThreadsAndIndicateIfWeAreFirst() { |
|
21 |
+ |
boolean rv = (mThreads == 0); |
|
22 |
+ |
mThreads++; |
|
23 |
+ |
return rv; |
|
24 |
+ |
} |
|
25 |
+ |
|
|
26 |
+ |
public synchronized void decThreads() { |
|
27 |
+ |
mThreads--; |
|
28 |
+ |
notifyAll(); |
|
29 |
+ |
} |
|
30 |
+ |
} |