From 4ffe8b84071babe544086f94c66431380d301d59 Mon Sep 17 00:00:00 2001 From: jestin Date: Sat, 12 May 2012 14:26:08 +0000 Subject: - minor code cleanup - adds a separate file (Protocol.java) containing the Enum values in a proper pattern - resolved a synchronization bug on Ivy.stop() --- src/IvyDaemon.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/IvyDaemon.java') diff --git a/src/IvyDaemon.java b/src/IvyDaemon.java index 2c0e42a..6fc884d 100644 --- a/src/IvyDaemon.java +++ b/src/IvyDaemon.java @@ -1,5 +1,6 @@ /** - * IvyDaemon: simple TCP to Ivy relay. + * IvyDaemon: simple TCP to Ivy relay, can be useful if a shell command wants + * to send a message on the bus. * * @author Yannick Jestin * @author http://www.tls.cena.fr/products/ivy/ @@ -20,7 +21,7 @@ * - goes into tools subpackage * 1.2.3 * - adds the traceDebug - * - uses the clientThread paradigm to programm the thread sync + * - uses the daemonThread paradigm to programm the thread sync * - invalid port number as a command line argument now stops the program * - cleans up the code * - adds a "quiet" option on the command line @@ -41,7 +42,7 @@ public class IvyDaemon implements Runnable { private ServerSocket serviceSocket; private static boolean debug = (System.getProperty("IVY_DEBUG")!=null) ; - private volatile Thread clientThread;// volatile to ensure the quick communication + private volatile Thread daemonThread;// volatile to ensure the quick communication private Ivy bus; public static final int DEFAULT_SERVICE_PORT = 3456 ; @@ -94,12 +95,12 @@ public class IvyDaemon implements Runnable { public IvyDaemon(Ivy bus,int servicePort) throws IOException { this.bus=bus; serviceSocket = new ServerSocket(servicePort) ; - clientThread=new Thread(this); - clientThread.setName("Ivy client thread set by Daemon ?! "); + daemonThread=new Thread(this); + daemonThread.setName("Ivy Daemon tool thread"); } protected void doStart() { - clientThread.start(); + daemonThread.start(); } /* @@ -109,7 +110,7 @@ public class IvyDaemon implements Runnable { public void run() { Thread thisThread = Thread.currentThread(); traceDebug("Thread started"); - while ( clientThread==thisThread ) { + while ( daemonThread==thisThread ) { try { new SubReader(serviceSocket.accept()); } catch( IOException e ) { -- cgit v1.1