From ac8c6c0d9bb921166697e9b13009f9ff83ba9716 Mon Sep 17 00:00:00 2001 From: jestin Date: Thu, 26 Apr 2012 15:26:33 +0000 Subject: Goes to a set of synchronized collections (Map, HashMap, ...) to try and avoid multithreaded issues ... --- src/Probe.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/Probe.java') diff --git a/src/Probe.java b/src/Probe.java index 4425dd4..c8021c5 100644 --- a/src/Probe.java +++ b/src/Probe.java @@ -7,6 +7,8 @@ * (c) CENA * * Changelog: + * 1.2.16 + * - now uses the synchronized wrappers of the Java API for all collections * 1.2.14 * - uses the "new" for: loop construct of Java5 * - throws RuntimeException instead of System.exit(), allows code reuse @@ -247,9 +249,8 @@ public class Probe implements IvyApplicationListener, IvyMessageListener, IvyBin int total=0; int boundedtotal=0; for (IvyClient ic: v) { - for (Enumeration e = ic.getRegexps();e.hasMoreElements();) { + for (String r : ic.getRegexps()) { total++; - String r = e.nextElement(); if (r.startsWith("^")) boundedtotal++; println(ic.getApplicationName()+" has subscribed to: "+r); } @@ -262,19 +263,16 @@ public class Probe implements IvyApplicationListener, IvyMessageListener, IvyBin Vectorv=bus.getIvyClientsByName(target); if (v.size()==0) println("no Ivy client with the name \""+target+"\""); for (IvyClient ic:v) { - for (Enumeration e = ic.getRegexps();e.hasMoreElements();) { + for (String r : ic.getRegexps()) { total++; - String r = e.nextElement(); if (r.startsWith("^")) boundedtotal++; - println(target+" has subscribed to: "+(String)e.nextElement()); + println(target+" has subscribed to: "+r); } System.out.println("total: "+total+", unbounded:"+(total-boundedtotal)); } } else if (s.lastIndexOf(".bound")>=0){ println("you have subscribed to:"); - for (Enumeration e = bus.getSelfIvyClient().getRegexps();e.hasMoreElements();) { - println("\t"+e.nextElement()); - } + for (String re : bus.getSelfIvyClient().getRegexps()) println("\t"+re); } else if (s.lastIndexOf(".bind ")>=0){ String regexp=s.substring(6); try { @@ -348,8 +346,6 @@ public class Probe implements IvyApplicationListener, IvyMessageListener, IvyBin public void connect(IvyClient client) { println(client.getApplicationName() + " connected " ); - // for (java.util.Enumeration e=client.getRegexps();e.hasMoreElements();) - // println(client.getApplicationName() + " subscribes to " +e.nextElement() ); } public void disconnect(IvyClient client) { -- cgit v1.1