diff options
Diffstat (limited to 'src/jrummikub')
-rw-r--r-- | src/jrummikub/control/network/ConnectionControl.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/jrummikub/control/network/ConnectionControl.java b/src/jrummikub/control/network/ConnectionControl.java index 2d8ff60..897d0f5 100644 --- a/src/jrummikub/control/network/ConnectionControl.java +++ b/src/jrummikub/control/network/ConnectionControl.java @@ -68,6 +68,12 @@ public class ConnectionControl implements IConnectionControl { private final static String ELEMENT_NAME = "rummikub"; private final static String NAMESPACE = "http://home.universe-factory.net/rummikub/"; + private final static Runnable STOP_ACTION = new Runnable() { + @Override + public void run() { + } + }; + private final LoginData loginData; private volatile Connection connection; private volatile MultiUserChat muc; @@ -120,18 +126,14 @@ public class ConnectionControl implements IConnectionControl { new Thread(new Runnable() { @Override public void run() { - while (true) { - Runnable runner; + Runnable runner = null; + do { try { runner = actionQueue.take(); - if (runner == null) { - return; - } - runner.run(); } catch (InterruptedException e) { } - } + } while (runner != STOP_ACTION); } }).start(); @@ -149,7 +151,7 @@ public class ConnectionControl implements IConnectionControl { connection.disconnect(); connection = null; } - ConnectionControl.this.run(null); + ConnectionControl.this.run(STOP_ACTION); } }); } |