[jboss-remoting-commits] JBoss Remoting SVN: r5455 - remoting2/branches/2.2/src/main/org/jboss/remoting.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Sat Sep 12 12:21:06 EDT 2009


Author: ron.sigal at jboss.com
Date: 2009-09-12 12:21:04 -0400 (Sat, 12 Sep 2009)
New Revision: 5455

Modified:
   remoting2/branches/2.2/src/main/org/jboss/remoting/LeasePinger.java
Log:
JBREM-1154: sendClientPing() and addClient() throw exceptions instead of swallowing them.

Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/LeasePinger.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/LeasePinger.java	2009-09-12 16:19:00 UTC (rev 5454)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/LeasePinger.java	2009-09-12 16:21:04 UTC (rev 5455)
@@ -172,8 +172,16 @@
       ClientHolder newClient = new ClientHolder(sessionID, configuration, leasePeriod);
       clientSessionIds.put(sessionID, newClient);
 
-      sendClientPing();
-
+      try
+      {
+         sendClientPing();
+      }
+      catch (Throwable t)
+      {
+         log.debug(this + " failed to ping to server", t);
+         log.warn(this + " failed to ping to server: " + t.getMessage());
+         throw new RuntimeException(t);
+      }
       // if new client lease period is less than the current ping period, need to refresh to new one
       if (leasePeriod < pingPeriod)
       {
@@ -339,42 +347,34 @@
    
    // Private --------------------------------------------------------------------------------------
 
-   private void sendClientPing()
+   private void sendClientPing() throws Throwable
    {
-      try
+      if(trace)
       {
-         if(trace)
+         StringBuffer sb = new StringBuffer();
+         if(clientSessionIds != null)
          {
-            StringBuffer sb = new StringBuffer();
-            if(clientSessionIds != null)
+            for(Iterator i = clientSessionIds.values().iterator(); i.hasNext(); )
             {
-               for(Iterator i = clientSessionIds.values().iterator(); i.hasNext(); )
-               {
-                  ClientHolder h = (ClientHolder)i.next();
-                  sb.append("    ").append(h.getSessionId()).append('\n');
-               }
+               ClientHolder h = (ClientHolder)i.next();
+               sb.append("    ").append(h.getSessionId()).append('\n');
             }
+         }
 
-            log.trace(this + " sending ping to server. Currently managing lease " +
+         log.trace(this + " sending ping to server. Currently managing lease " +
                "for following clients:\n" + sb.toString());
-         }
+      }
 
-         Map clientsClone = new ConcurrentHashMap(clientSessionIds);
-         Map requestClients = new ConcurrentHashMap();
-         requestClients.put(ClientHolder.CLIENT_HOLDER_KEY, clientsClone);
-         requestClients.put(LeasePinger.LEASE_PINGER_ID, leasePingerId);
-         requestClients.put(TIME_STAMP, Long.toString(System.currentTimeMillis()));
-         
-         InvocationRequest ir = new InvocationRequest(invokerSessionID, null, "$PING$", requestClients, null, null);
-         invoker.invoke(ir);
+      Map clientsClone = new ConcurrentHashMap(clientSessionIds);
+      Map requestClients = new ConcurrentHashMap();
+      requestClients.put(ClientHolder.CLIENT_HOLDER_KEY, clientsClone);
+      requestClients.put(LeasePinger.LEASE_PINGER_ID, leasePingerId);
+      requestClients.put(TIME_STAMP, Long.toString(System.currentTimeMillis()));
 
-         if(trace) { log.trace(this + " successfully pinged the server"); }
-      }
-      catch (Throwable t)
-      {
-         log.debug(this + " failed to ping to server", t);
-         log.warn(this + " failed to ping to server: " + t.getMessage());
-      }
+      InvocationRequest ir = new InvocationRequest(invokerSessionID, null, "$PING$", requestClients, null, null);
+      invoker.invoke(ir);
+
+      if(trace) { log.trace(this + " successfully pinged the server"); }
    }
 
    // Inner classes --------------------------------------------------------------------------------
@@ -398,7 +398,15 @@
 
          if (currentPinger != null)
          {
-             currentPinger.sendClientPing();
+            try
+            {
+               currentPinger.sendClientPing();
+            }
+            catch (Throwable t)
+            {
+               log.debug(this + " failed to ping to server", t);
+               log.warn(this + " failed to ping to server: " + t.getMessage());
+            }
          }
       }
 



More information about the jboss-remoting-commits mailing list