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

Ron Sigal ron_sigal at yahoo.com
Tue Jun 19 21:13:46 EDT 2007


  User: rsigal  
  Date: 07/06/19 21:13:46

  Modified:    src/main/org/jboss/remoting/transport/bisocket  Tag:
                        remoting_2_2_0_SP4_CP BisocketClientInvoker.java
  Log:
  JBREM-748:  Catches exceptions when scheduling a TimerTask and recreates Timer.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.13.2.2.2.1 +19 -4     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.2
  retrieving revision 1.1.2.13.2.2.2.1
  diff -u -b -r1.1.2.13.2.2 -r1.1.2.13.2.2.2.1
  --- BisocketClientInvoker.java	16 Apr 2007 19:11:32 -0000	1.1.2.13.2.2
  +++ BisocketClientInvoker.java	20 Jun 2007 01:13:45 -0000	1.1.2.13.2.2.2.1
  @@ -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,14 +222,27 @@
               controlOutputStream = controlSocket.getOutputStream();
               log.debug("got control socket: " + controlSocket);
               pingTimerTask = new PingTimerTask(this);
  +
  +            synchronized (timerLock)
  +            {
               if (timer == null)
               {
                  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);
            }
         }
      }
  +      }
  +   }
   
      public int getMaxRetries()
      {
  @@ -404,7 +418,8 @@
            pingTimerTask.cancel();
   
         pingTimerTask = new PingTimerTask(this);
  -      if (timer == null)
  +
  +      synchronized (timerLock)
         {
            timer = new Timer(true);
         }
  
  
  



More information about the jboss-cvs-commits mailing list