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

Tom Elrod tom.elrod at jboss.com
Mon Dec 11 22:48:04 EST 2006


  User: telrod  
  Date: 06/12/11 22:48:04

  Modified:    src/main/org/jboss/remoting   Tag: remoting_2_x Client.java
                        LeasePinger.java
  Log:
  JBREM-649 - fixed thread sync issue for lease pinging
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.53.2.9  +24 -24    JBossRemoting/src/main/org/jboss/remoting/Client.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Client.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/Client.java,v
  retrieving revision 1.53.2.8
  retrieving revision 1.53.2.9
  diff -u -b -r1.53.2.8 -r1.53.2.9
  --- Client.java	7 Dec 2006 20:45:39 -0000	1.53.2.8
  +++ Client.java	12 Dec 2006 03:48:04 -0000	1.53.2.9
  @@ -63,7 +63,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.53.2.8 $
  + * @version $Revision: 1.53.2.9 $
    */
   public class Client implements Externalizable
   {
  @@ -686,7 +686,7 @@
       * is handled by thread in this pool and user's call returns immediately)
       * Default value is MAX_NUM_ONEWAY_THREADS.
       *
  -    * @param numOfThreads
  +    * @param maxOnewayThreadPoolQueueSize
       */
      public void setMaxOnewayThreadPoolQueueSize(int maxOnewayThreadPoolQueueSize)
      {
  
  
  
  1.8.2.1   +13 -9     JBossRemoting/src/main/org/jboss/remoting/LeasePinger.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LeasePinger.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/LeasePinger.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -b -r1.8 -r1.8.2.1
  --- LeasePinger.java	21 Sep 2006 15:59:04 -0000	1.8
  +++ LeasePinger.java	12 Dec 2006 03:48:04 -0000	1.8.2.1
  @@ -10,6 +10,8 @@
   import java.util.Map;
   import java.util.TimerTask;
   
  +import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
  +
   /**
    * Internal agent class to ping the remote server to keep lease alive.
    *
  @@ -21,7 +23,7 @@
      private long pingPeriod = -1;
      private long defaultPingPeriod = -1;
      private String invokerSessionId = null;
  -   private Map clients = new HashMap();
  +   private Map clients = new ConcurrentHashMap();
      private TimerTask timerTask = null;
   
      private static final Logger log = Logger.getLogger(LeasePinger.class);
  @@ -35,7 +37,7 @@
         this.invokerSessionId = invokerSessionId;
      }
   
  -   public void startPing()
  +   public synchronized void startPing()
      {
         if(isTraceEnabled)
         {
  @@ -45,7 +47,7 @@
         TimerUtil.schedule(timerTask, pingPeriod);
      }
   
  -   public void stopPing()
  +   public synchronized void stopPing()
      {
         if(isTraceEnabled)
         {
  @@ -69,7 +71,7 @@
         }
      }
   
  -   protected void sendClientPing()
  +   protected synchronized void sendClientPing()
      {
         if (client != null)
         {
  @@ -92,9 +94,11 @@
                            "Currently managing lease for following clients:\n" + clientSessionIds);
               } // end trace
   
  -            Map clientsClone = new HashMap();
  -            clientsClone.put(ClientHolder.CLIENT_HOLDER_KEY, clients);
  -            client.invoke(new InvocationRequest(invokerSessionId, null, "$PING$", clientsClone, null, null));
  +            Map clientsClone = new ConcurrentHashMap();
  +            clientsClone.putAll(clients);
  +            Map requestClients = new ConcurrentHashMap();
  +            requestClients.put(ClientHolder.CLIENT_HOLDER_KEY, clientsClone);
  +            client.invoke(new InvocationRequest(invokerSessionId, null, "$PING$", requestClients, null, null));
            }
            catch (Throwable throwable)
            {
  @@ -103,7 +107,7 @@
         }
      }
   
  -   public void addClient(String sessionId, Map configuration, long leasePeriod)
  +   public synchronized void addClient(String sessionId, Map configuration, long leasePeriod)
      {
         if (leasePeriod <= 0)
         {
  @@ -134,7 +138,7 @@
         }
      }
   
  -   public boolean removeClient(String sessionId)
  +   public synchronized boolean removeClient(String sessionId)
      {
         boolean isLastClientLease = false;
   
  
  
  



More information about the jboss-cvs-commits mailing list