From 750f33265d208df8218f85359e3f027900c58363 Mon Sep 17 00:00:00 2001 From: jestin Date: Fri, 22 Jul 2011 16:49:57 +0000 Subject: Passage en 1.2.14 --- src/IvyHttpGatewayServlet.java | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'src/IvyHttpGatewayServlet.java') diff --git a/src/IvyHttpGatewayServlet.java b/src/IvyHttpGatewayServlet.java index ca886b5..fd22bd2 100644 --- a/src/IvyHttpGatewayServlet.java +++ b/src/IvyHttpGatewayServlet.java @@ -64,14 +64,13 @@ import fr.dgac.ivy.*; *           * GNU Lesser General Public License, see http://www.gnu.org/copyleft/lesser.html * - * @see fr.dgac.ivy * @author Francis JAMBON - CLIPS-IMAG/MultiCom * @version 1.1 */ public class IvyHttpGatewayServlet extends HttpServlet { // Ivy bus(es) list - private Hashtable buses; + private Hashtable buses; // Valid name, domain and msg regexps private static final String NAME_REGEXP="[^(\\r)]+"; @@ -89,7 +88,7 @@ public class IvyHttpGatewayServlet extends HttpServlet { */ public void init(ServletConfig config) throws ServletException { super.init(config); - this.buses = new Hashtable(); + this.buses = new Hashtable(); } @@ -97,10 +96,7 @@ public class IvyHttpGatewayServlet extends HttpServlet { * Destroys the servlet. */ public void destroy() { - Enumeration eb = this.buses.elements(); - while (eb.hasMoreElements()) { - ((Ivy)eb.nextElement()).stop(); - } + for (Ivy eb : this.buses.values() ) eb.stop(); // wait 100ms to prevent ugly Ivy bus(es) disconnection try { Thread.sleep(100); } catch (InterruptedException ie) {} this.buses.clear(); @@ -324,9 +320,7 @@ public class IvyHttpGatewayServlet extends HttpServlet { out.println(); out.println(this.buses.size()+" Ivy bus(es) alive"); - Enumeration ek = this.buses.keys(); - while (ek.hasMoreElements()) { - IvyHashKey ihk = (IvyHashKey)(ek.nextElement()); + for (IvyHashKey ihk : this.buses.keySet()) { out.println("- Ivy bus ["+ihk.getName()+ "] on domain ["+ihk.getDomain()+ "] managed by ["+ihk.getFrom()+"]"); @@ -362,14 +356,8 @@ public class IvyHttpGatewayServlet extends HttpServlet { out.println(); if (this.buses.size()!=0) { - - Enumeration eb = this.buses.elements(); - while (eb.hasMoreElements()) { - ((Ivy)eb.nextElement()).stop(); - } - Enumeration ek = this.buses.keys(); - while (ek.hasMoreElements()) { - IvyHashKey ihk = (IvyHashKey)(ek.nextElement()); + for (Ivy eb : this.buses.values() ) eb.stop(); + for ( IvyHashKey ihk : this.buses.keySet()) { out.println("Ivy bus ["+ihk.getName()+ "] on domain ["+ihk.getDomain()+ "] managed by ["+ihk.getFrom()+ -- cgit v1.1