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

Ron Sigal ron_sigal at yahoo.com
Fri Aug 17 16:25:50 EDT 2007


  User: rsigal  
  Date: 07/08/17 16:25:50

  Modified:    src/main/org/jboss/remoting  Tag:
                        remoting_2_2_2_experimental Lease.java
  Log:
  JBREM-783, JBREM-793: (1) Just send individual leases instead of all leases; (2) renamed requestPayload to leaseHolders and made it ConcurrentHashMap.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.11.2.1.4.1.2.1 +34 -8     JBossRemoting/src/main/org/jboss/remoting/Lease.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Lease.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/Lease.java,v
  retrieving revision 1.11.2.1.4.1
  retrieving revision 1.11.2.1.4.1.2.1
  diff -u -b -r1.11.2.1.4.1 -r1.11.2.1.4.1.2.1
  --- Lease.java	8 Aug 2007 00:07:13 -0000	1.11.2.1.4.1
  +++ Lease.java	17 Aug 2007 20:25:49 -0000	1.11.2.1.4.1.2.1
  @@ -24,7 +24,10 @@
   import org.jboss.logging.Logger;
   import org.jboss.remoting.util.TimerUtil;
   
  +import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
  +
   import java.util.Collection;
  +import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Map;
   import java.util.TimerTask;
  @@ -43,7 +46,7 @@
      private String clientSessionId = null;
      private long leasePeriod = -1;
      private String locatorURL = null;
  -   private Map requestPayload = null;
  +   private Map leaseHolders = null;
      private LeaseTimerTask leaseTimerTask = null;
      private long leaseWindow = -1;
      private long pingStart = -1;
  @@ -63,8 +66,22 @@
         this.locatorURL = locatorurl;
         if(requestPayload != null)
         {
  -         this.requestPayload = (Map)requestPayload.get(ClientHolder.CLIENT_HOLDER_KEY);
  +         Object o = requestPayload.get(ClientHolder.CLIENT_HOLDER_KEY);
  +         if (o instanceof Map)
  +         {
  +            this.leaseHolders = new ConcurrentHashMap((Map) o);
  +         }
  +         else
  +         {
  +            log.warn(("unrecognized client holder: " + o));
  +            this.leaseHolders = new ConcurrentHashMap();
  +         }
         }
  +      else
  +      {
  +         this.leaseHolders = new ConcurrentHashMap();
  +      }
  +
         this.leaseWindow = leasePeriod * 2;
         this.clientLeases = clientLeases;
      }
  @@ -84,7 +101,16 @@
      {
         if(requestMap != null)
         {
  -         this.requestPayload = (Map)requestMap.get(ClientHolder.CLIENT_HOLDER_KEY);
  +         Object o = requestMap.get(ClientHolder.CLIENT_HOLDER_KEY);
  +         if (o instanceof ClientHolder)
  +         {
  +            ClientHolder holder = (ClientHolder) o;
  +            leaseHolders.put(holder.getSessionId(), holder);
  +         }
  +         else
  +         {
  +            log.warn(this + " unrecognized object in request payload: " + o);
  +         }
         }
         updateLease(leasePeriod);
      }
  @@ -147,12 +173,12 @@
      private void notifyClientTermination(String sessionId)
      {
         // is for a particular client, so need to inspect request payload for client
  -      if (requestPayload != null)
  +      if (leaseHolders != null)
         {
            // should notify for one client or all?
            if (sessionId != null)
            {
  -            Object clientHolderObj = requestPayload.remove(sessionId);
  +            Object clientHolderObj = leaseHolders.remove(sessionId);
               if (clientHolderObj != null && clientHolderObj instanceof ClientHolder)
               {
                  ClientHolder clientHolder = (ClientHolder) clientHolderObj;
  @@ -166,7 +192,7 @@
            else
            {
               // loop through and notify for all clients
  -            Collection clientHoldersCol = requestPayload.values();
  +            Collection clientHoldersCol = leaseHolders.values();
               if (clientHoldersCol != null && clientHoldersCol.size() > 0)
               {
                  Iterator itr = clientHoldersCol.iterator();
  @@ -195,10 +221,10 @@
      private void notifyClientLost()
      {
         // is not for a particular client (but all clients associated with client invoker), so need to inspect request payload for client
  -      if (requestPayload != null)
  +      if (leaseHolders != null)
         {
            // loop through and notify for all clients
  -         Collection clientHoldersCol = requestPayload.values();
  +         Collection clientHoldersCol = leaseHolders.values();
            if (clientHoldersCol != null && clientHoldersCol.size() > 0)
            {
               Iterator itr = clientHoldersCol.iterator();
  
  
  



More information about the jboss-cvs-commits mailing list