r9859 - helma/extensions/helmaswarm/trunk/src/helma/swarm

[email protected] Tue, 8 Sep 2009 22:23:19 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090908202319.BC8763D0E3@mia>
Author: hannes
Date: 2009-09-08 22:23:19 +0200 (Tue, 08 Sep 2009)
New Revision: 9859

Modified:
   helma/extensions/helmaswarm/trunk/src/helma/swarm/SwarmSessionManager.java
Log:
Reduce session keepalive pulse to 3 seconds, put more of broadcastIds into the try-catch statement.


Details at http://dev.helma.org/trac/helma/changeset/9859

Modified: helma/extensions/helmaswarm/trunk/src/helma/swarm/SwarmSessionManager.java
===================================================================
--- helma/extensions/helmaswarm/trunk/src/helma/swarm/SwarmSessionManager.java	2009-09-08 19:52:11 UTC (rev 9858)
+++ helma/extensions/helmaswarm/trunk/src/helma/swarm/SwarmSessionManager.java	2009-09-08 20:23:19 UTC (rev 9859)
@@ -121,7 +121,7 @@
     public void run() {
         while(runner == Thread.currentThread()) {
             try {
-                Thread.sleep(1000l);
+                Thread.sleep(2000l);
             } catch (InterruptedException x) {
                 log.info("SwarmSession: broadcast thread interrupted, exiting");
                 return;
@@ -245,16 +245,16 @@
     }
 
     void broadcastIds(int operation, Set idSet) {
-        if (!idSet.isEmpty()) {
-            Object[] ids = idSet.toArray();
-            for (int i=0; i<ids.length; i++)
-                idSet.remove(ids[i]);
-            Serializable idlist = new SessionIdList(operation, ids);
-            try {
+        try {
+            if (!idSet.isEmpty()) {
+                Object[] ids = idSet.toArray();
+                for (int i = 0; i < ids.length; i++)
+                    idSet.remove(ids[i]);
+                Serializable idlist = new SessionIdList(operation, ids);
                 adapter.send(new Message(null, address, idlist));
-            } catch (Exception x) {
-                log.error("Error broadcasting session list", x);
             }
+        } catch (Exception x) {
+            log.error("Error broadcasting session list", x);
         }
     }