diff options
Diffstat (limited to 'src/IvyHttpGatewayServlet.java')
-rw-r--r-- | src/IvyHttpGatewayServlet.java | 24 |
1 files changed, 6 insertions, 18 deletions
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 <a target="_blank" href="http://www.gnu.org/copyleft/lesser.html">http://www.gnu.org/copyleft/lesser.html</a> * - * @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<IvyHashKey,Ivy> 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<IvyHashKey,Ivy>(); } @@ -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()+ |