sventon subversion web client - http://www.sventon.org
[show recent changes]
 
  Help
HEAD
Rev: 32858 - http://anonsvn.icesoft.org/repo / icepush / trunk / icepush / core / src / main / java / org / icepush / servlet / BrowserDispatcher.java
Unified Diff View - BrowserDispatcher.java
/icepush/trunk/icepush/core/src/main/java/org/icepush/servlet/BrowserDispatcher.java @ revision 32857
/icepush/trunk/icepush/core/src/main/java/org/icepush/servlet/BrowserDispatcher.java @ revision 32858
@@ -46,10 +46,11 @@     }     public void shutdown() { -        Iterator i = browserBoundServlets.values().iterator(); -        while (i.hasNext()) { -            PseudoServlet servlet = (PseudoServlet) i.next(); -            servlet.shutdown(); +        synchronized (browserBoundServlets) { +            Iterator i = new ArrayList(browserBoundServlets.values()).iterator(); +            while (i.hasNext()) { +                ((PseudoServlet)i.next()).shutdown(); +            }         }     } @@ -64,7 +65,9 @@     }     protected PseudoServlet lookupServer(final String browserID) { -        return (PseudoServlet) browserBoundServlets.get(browserID); +        synchronized (browserBoundServlets) { +            return (PseudoServlet)browserBoundServlets.get(browserID); +        }     }     public static String getBrowserIDFromCookie(HttpServletRequest request) { @@ -88,10 +91,11 @@     }     private void discardUnusedServlets() { -        Iterator i = new ArrayList(browserBoundServlets.values()).iterator(); -        while (i.hasNext()) { -            BrowserEntry entry = (BrowserEntry) i.next(); -            entry.discardIfExpired(); +        synchronized (browserBoundServlets) { +            Iterator i = new ArrayList(browserBoundServlets.values()).iterator(); +            while (i.hasNext()) { +                ((BrowserEntry)i.next()).discardIfExpired(); +            }         }     } @@ -127,7 +131,9 @@                 } catch (Throwable t) {                     log.fine("Failed to discard browser bound server for ID=" + id);                 } finally { -                    browserBoundServlets.remove(id); +                    synchronized (browserBoundServlets) { +                        browserBoundServlets.remove(id); +                    }                     log.fine("Discarded browser bound server for ID=" + id);                 }             }


feed icon

sventon 2.5.1