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

Ron Sigal ron_sigal at yahoo.com
Fri Jun 29 22:54:53 EDT 2007


  User: rsigal  
  Date: 07/06/29 22:54:53

  Modified:    src/main/org/jboss/remoting/transport/bisocket  Tag:
                        remoting_2_2_0_GA BisocketClientInvoker.java
  Log:
  JBREM-748:  Put Timer.schedule() in a try/catch block.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.13.2.4 +20 -23    JBossRemoting/src/main/org/jboss/remoting/transport/bisocket/BisocketClientInvoker.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BisocketClientInvoker.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/bisocket/BisocketClientInvoker.java,v
  retrieving revision 1.1.2.13.2.3
  retrieving revision 1.1.2.13.2.4
  diff -u -b -r1.1.2.13.2.3 -r1.1.2.13.2.4
  --- BisocketClientInvoker.java	31 May 2007 06:25:18 -0000	1.1.2.13.2.3
  +++ BisocketClientInvoker.java	30 Jun 2007 02:54:53 -0000	1.1.2.13.2.4
  @@ -73,6 +73,7 @@
      private static Map listenerIdToCallbackClientInvokerMap = Collections.synchronizedMap(new HashMap());
      private static Map listenerIdToSocketsMap = new HashMap();
      private static Timer timer;
  +   private static Object timerLock = new Object();
   
      protected String listenerId;
   
  @@ -221,6 +222,9 @@
               controlOutputStream = controlSocket.getOutputStream();
               log.debug("got control socket: " + controlSocket);
               pingTimerTask = new PingTimerTask(this);
  +
  +            synchronized (timerLock)
  +            {
               if (timer == null)
               {
                  timer = new Timer(true);
  @@ -238,6 +242,7 @@
            }
         }
      }
  +   }
   
      public int getMaxRetries()
      {
  @@ -413,21 +418,13 @@
            pingTimerTask.cancel();
   
         pingTimerTask = new PingTimerTask(this);
  -      if (timer == null)
  +
  +      synchronized (timerLock)
         {
            timer = new Timer(true);
         }
  -      try
  -      {
  -         timer.schedule(pingTimerTask, pingFrequency, pingFrequency);
  -      }
  -      catch (IllegalStateException e)
  -      {
  -         log.debug("Unable to schedule TimerTask on existing Timer", e);
  -         timer = new Timer(true);
            timer.schedule(pingTimerTask, pingFrequency, pingFrequency);
         }
  -   }
   
   
      InvokerLocator getSecondaryLocator() throws Throwable
  
  
  



More information about the jboss-cvs-commits mailing list