From 6fbefad24ec7e8783365db61b03357d50ee0dd56 Mon Sep 17 00:00:00 2001 From: jestin Date: Fri, 27 Apr 2012 08:55:56 +0000 Subject: added names to the threads, in order to allow jvisualvm debug removed a "My DEBUG" message on the console --- src/IvyClient.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/IvyClient.java') diff --git a/src/IvyClient.java b/src/IvyClient.java index 80b30b8..441013f 100755 --- a/src/IvyClient.java +++ b/src/IvyClient.java @@ -122,6 +122,7 @@ public class IvyClient extends Thread { // private variables private final static int MAXPONGCALLBACKS = 10; + // FIXME should not be static ? (findbugs) private static int pingSerial = 0; private static final Object lock = new Object(); private static int clientSerial=0; /* an unique ID for each IvyClient */ @@ -167,6 +168,7 @@ public class IvyClient extends Thread { } remoteHostname = socket.getInetAddress().getHostName(); clientThread = new Thread(this); // clientThread handles the incoming traffic + clientThread.setName("Ivy client thread to "+remoteHostname+":"+remotePort); } /* removed from the constructor, to avoid Mulithread correctnaess issuses @@ -265,9 +267,12 @@ public class IvyClient extends Thread { */ public void ping(PingCallback pc) throws IvyException { PCHadd(pingSerial,pc); - sendString(Ping,pingSerial++,""); + sendString(Ping,pingSerial,""); + incSerial(); } + private synchronized static void incSerial() {pingSerial++;} + /////////////////////////////////////////////////// // // PROTECTED METHODS -- cgit v1.1