diff options
author | jestin | 2012-04-26 15:26:33 +0000 |
---|---|---|
committer | jestin | 2012-04-26 15:26:33 +0000 |
commit | ac8c6c0d9bb921166697e9b13009f9ff83ba9716 (patch) | |
tree | 1661b2885aa4d4be2f3cf26deda479641d6f6630 /src/Probe.java | |
parent | 934dfab1b2e6571f241facfcadc733d25a411024 (diff) | |
download | ivy-java-ac8c6c0d9bb921166697e9b13009f9ff83ba9716.zip ivy-java-ac8c6c0d9bb921166697e9b13009f9ff83ba9716.tar.gz ivy-java-ac8c6c0d9bb921166697e9b13009f9ff83ba9716.tar.bz2 ivy-java-ac8c6c0d9bb921166697e9b13009f9ff83ba9716.tar.xz |
Goes to a set of synchronized collections (Map, HashMap, ...) to try and avoid
multithreaded issues ...
Diffstat (limited to 'src/Probe.java')
-rw-r--r-- | src/Probe.java | 16 |
1 files changed, 6 insertions, 10 deletions
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<String> 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 Vector<IvyClient>v=bus.getIvyClientsByName(target); if (v.size()==0) println("no Ivy client with the name \""+target+"\""); for (IvyClient ic:v) { - for (Enumeration<String> 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<String> 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) { |