[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting ...

Ron Sigal ron_sigal at yahoo.com
Tue Aug 7 14:00:12 EDT 2007


  User: rsigal  
  Date: 07/08/07 14:00:12

  Modified:    src/main/org/jboss/remoting  Tag: remoting_2_2_0_GA
                        MicroRemoteClientInvoker.java
  Log:
  JBREM-783: (1) Reorganized establishLease() to avoid network i/o in LeasePinger.addClient(), and (2) reorganized terminateLease() to call stopPing() before LeasePinger.removeCliient().
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.7.2.14.4.2 +34 -21    JBossRemoting/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: MicroRemoteClientInvoker.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java,v
  retrieving revision 1.7.2.14.4.1
  retrieving revision 1.7.2.14.4.2
  diff -u -b -r1.7.2.14.4.1 -r1.7.2.14.4.2
  --- MicroRemoteClientInvoker.java	2 Aug 2007 06:33:39 -0000	1.7.2.14.4.1
  +++ MicroRemoteClientInvoker.java	7 Aug 2007 18:00:12 -0000	1.7.2.14.4.2
  @@ -27,7 +27,7 @@
    *
    * @author <a href="mailto:jhaynie at vocalocity.net">Jeff Haynie</a>
    * @author <a href="mailto:telrod at e2technologies.net">Tom Elrod</a>
  - * @version $Revision: 1.7.2.14.4.1 $
  + * @version $Revision: 1.7.2.14.4.2 $
    */
   public abstract class MicroRemoteClientInvoker extends AbstractInvoker implements ClientInvoker
   {
  @@ -346,9 +346,6 @@
   
         if (localPinger != null)
         {
  -         localPinger.setDisconnectTimeout(disconnectTimeout);
  -         localPinger.disconnectClient(sessionId);
  -
            if (isLastClientLease)
            {
               try
  @@ -360,6 +357,9 @@
                  log.error("error shutting down lease pinger");
               }
            }
  +         
  +         localPinger.setDisconnectTimeout(disconnectTimeout);
  +         localPinger.disconnectClient(sessionId);
         }
      }
   
  @@ -391,21 +391,26 @@
         // inside the synchronization block.  The advantage is that other Client's
         // can call terminateLease() without being blocked.
         
  +      boolean pingerIsStarted = false;
  +      
         synchronized (clientLeaseLock)
         {
            // if already have a lease pinger, then already have a client with an established
            // lease and just need to update the lease pinger
            if (leasePinger != null)
            {
  -            leasePinger.addClient(clientSessionID, configuration, leasePeriod);
  -            log.debug(this + " added client with session ID " + clientSessionID + " to the lease pinger");
  -            
  -            if (leasePinger.isStarted())
  -               return;
  -            
               if (leasePingerException != null)
                  throw leasePingerException;
               
  +            if (leasePinger.isStarted())
  +            {
  +               pingerIsStarted = true;
  +            }
  +            else
  +            {
  +               leasePinger.addClient(clientSessionID, configuration, leasePeriod, false);
  +               log.debug(this + " added client with session ID " + clientSessionID + " to the lease pinger");
  + 
               while (true)
               {
                  try
  @@ -421,6 +426,7 @@
                     throw leasePingerException;
               }
            }
  +         }
            else
            {
               leasePingerException = null;
  @@ -428,6 +434,13 @@
            }
         }
         
  +      if (pingerIsStarted)
  +      {
  +         leasePinger.addClient(clientSessionID, configuration, leasePeriod, true);
  +         log.debug(this + " added client with session ID " + clientSessionID + " to the lease pinger");
  +         return;
  +      }
  +      
         InvocationRequest ir =
            new InvocationRequest(invokerSessionID, null, "$PING$", null, new HashMap(), null);
         
  @@ -493,7 +506,7 @@
                     if(trace) { log.trace("server does have leasing enabled (with default lease period of " +
                           defaultLeasePeriod + ") and will start a new lease pinger."); }
   
  -                  leasePinger.addClient(clientSessionID, configuration, leasePeriod);
  +                  leasePinger.addClient(clientSessionID, configuration, leasePeriod, true);
                     
                     synchronized (clientLeaseLock)
                     {
  
  
  



More information about the jboss-cvs-commits mailing list