diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/IvyClient.java | 9 | ||||
-rw-r--r-- | src/SelfIvyClient.java | 8 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/IvyClient.java b/src/IvyClient.java index 17ce224..80b30b8 100755 --- a/src/IvyClient.java +++ b/src/IvyClient.java @@ -183,9 +183,12 @@ public class IvyClient extends Thread { private void sendSchizo() throws IOException { traceDebug("sending our service port "+bus.getAppPort()); Map<Integer,String> tosend=bus.getSelfIvyClient().regexpsText; - sendString(SchizoToken,bus.getAppPort(),bus.getAppName()); - for (Integer ikey : tosend.keySet()) sendRegexp(ikey.intValue(),tosend.get(ikey)); - sendString( EndRegexp,0,""); + synchronized (tosend) { + sendString(SchizoToken,bus.getAppPort(),bus.getAppName()); + for (Map.Entry<Integer,String> me : tosend.entrySet()) + sendRegexp( me.getKey().intValue() , me.getValue() ); + sendString( EndRegexp,0,""); + } } public String toString() { diff --git a/src/SelfIvyClient.java b/src/SelfIvyClient.java index 3e9ba6a..2cfc016 100644 --- a/src/SelfIvyClient.java +++ b/src/SelfIvyClient.java @@ -83,11 +83,11 @@ public class SelfIvyClient extends IvyClient { // unbinds to the first regexp protected synchronized boolean unBindMsg(String re) { synchronized (regexpsText) { - if (regexpsText.get(re) == null) return false; - for (Integer k : regexpsText.keySet()) { - if ( (regexpsText.get(k)).compareTo(re) == 0) { + if (!regexpsText.containsValue(re)) return false; + for (Map.Entry<Integer,String> me : regexpsText.entrySet()) { + if ( me.getValue().equals(re) ) { try { - bus.unBindMsg(k.intValue()); + bus.unBindMsg(me.getKey().intValue()); } catch (IvyException ie) { return false; } |