diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-11 14:58:48 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-11 14:58:48 +0100 |
commit | 47e43eefebae63afee1a1743602c15e3b1ede8ff (patch) | |
tree | 288ca3ee04e3365de9e2d78d51375be0b1bbac94 /jsonrpc/src/main/java | |
parent | 14205be283ad5b54a94c07308ab3e336f3069653 (diff) |
Add SameState test.
Test network participation.
Diffstat (limited to 'jsonrpc/src/main/java')
-rw-r--r-- | jsonrpc/src/main/java/com/orbekk/same/SameState.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/jsonrpc/src/main/java/com/orbekk/same/SameState.java b/jsonrpc/src/main/java/com/orbekk/same/SameState.java index c3d03f9..9638252 100644 --- a/jsonrpc/src/main/java/com/orbekk/same/SameState.java +++ b/jsonrpc/src/main/java/com/orbekk/same/SameState.java @@ -143,9 +143,19 @@ public class SameState extends Thread implements UrlReceiver { pendingParticipants.clear(); } + /** + * This method runs the pending commands to SameState. + * + * It should be called by the worker thread, but can be called directly + * for testing purposes to avoid threading in unit tests. + */ + synchronized void internalRun() { + handleNewParticipants(); + } + public synchronized void run() { while (!stopped) { - handleNewParticipants(); + internalRun(); try { wait(1000); } catch (InterruptedException e) { |