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/IvyWatcher.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/IvyWatcher.java') diff --git a/src/IvyWatcher.java b/src/IvyWatcher.java index cbd3910..f6507bb 100755 --- a/src/IvyWatcher.java +++ b/src/IvyWatcher.java @@ -116,6 +116,7 @@ class IvyWatcher extends Thread { busWatcherId=bus.getWatcherId(); listenThread = new Thread(this); listenThread.setName("Ivy Watcher thread for "+domainaddr+":"+port); + listenThread.setDaemon(true); // create the MulticastSocket try { group = InetAddress.getByName(domainaddr); @@ -156,10 +157,10 @@ class IvyWatcher extends Thread { continue; } int version = Integer.parseInt(m.group(1)); - if ( version < Ivy.PROTOCOLMINIMUM ) { + if ( version < Protocol.PROTOCOLMINIMUM ) { System.err.println("Ignoring bad format broadcast from "+ remotehostname+":"+packet.getPort() - +" protocol version "+remotehost+" we need "+Ivy.PROTOCOLMINIMUM+" minimum"); + +" protocol version "+remotehost+" we need "+Protocol.PROTOCOLMINIMUM+" minimum"); continue; } remotePort = Integer.parseInt(m.group(2)); @@ -291,7 +292,7 @@ class IvyWatcher extends Thread { synchronized void doStart() throws IvyException { // String hello = Ivy.PROTOCOLVERSION + " " + bus.getAppPort() + "\n"; - String hello = Ivy.PROTOCOLVERSION + " " + bus.getAppPort() + " "+busWatcherId+" "+bus.getSelfIvyClient().getApplicationName()+"\n"; + String hello = Protocol.PROTOCOLVERSION + " " + bus.getAppPort() + " "+busWatcherId+" "+bus.getSelfIvyClient().getApplicationName()+"\n"; if (broadcast==null) throw new IvyException("IvyWatcher PacketSender null broadcast address"); new PacketSender(hello,bus); // notifies our arrival on each domain: protocol version + port listenThread.start(); -- cgit v1.1