diff options
Diffstat (limited to 'src/IvyClient.java')
-rwxr-xr-x | src/IvyClient.java | 7 |
1 files changed, 6 insertions, 1 deletions
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 |