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

Ron Sigal ron_sigal at yahoo.com
Sun Jul 29 01:45:41 EDT 2007


  User: rsigal  
  Date: 07/07/29 01:45:41

  Modified:    src/main/org/jboss/remoting/transport/bisocket  Tag:
                        remoting_2_2_0_GA BisocketServerInvoker.java
  Log:
  JBREM-778:  start() creates a new Timer only when necessary.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.17.2.5 +20 -4     JBossRemoting/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BisocketServerInvoker.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java,v
  retrieving revision 1.1.2.17.2.4
  retrieving revision 1.1.2.17.2.5
  diff -u -b -r1.1.2.17.2.4 -r1.1.2.17.2.5
  --- BisocketServerInvoker.java	1 Jul 2007 19:13:56 -0000	1.1.2.17.2.4
  +++ BisocketServerInvoker.java	29 Jul 2007 05:45:41 -0000	1.1.2.17.2.5
  @@ -58,7 +58,7 @@
   /**
    *
    * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
  - * @version $Revision: 1.1.2.17.2.4 $
  + * @version $Revision: 1.1.2.17.2.5 $
    * <p>
    * Copyright Nov 23, 2006
    * </p>
  @@ -69,6 +69,7 @@
   
      private static Map listenerIdToServerInvokerMap = Collections.synchronizedMap(new HashMap());
      private static Timer timer;
  +   private static Object timerLock = new Object();
   
      private Map listenerIdToInvokerLocatorMap = Collections.synchronizedMap(new HashMap());
      private ServerSocket secondaryServerSocket;
  @@ -148,9 +149,24 @@
            threadpool = new LinkedList();
            checkSocketFactoryWrapper();
            
  -         timer = new Timer(true);
            controlMonitorTimerTask = new ControlMonitorTimerTask(this);
  +         synchronized (timerLock)
  +         {
  +            if (timer == null)
  +            {
  +               timer = new Timer(true);
  +            }
  +            try
  +            {
            timer.schedule(controlMonitorTimerTask, pingFrequency, pingFrequency);
  +            }
  +            catch (IllegalStateException e)
  +            {
  +               log.debug("Unable to schedule TimerTask on existing Timer", e);
  +               timer = new Timer(true);
  +               timer.schedule(controlMonitorTimerTask, pingFrequency, pingFrequency);
  +            }
  +         }
            
            running = true;
            started = true;
  
  
  



More information about the jboss-cvs-commits mailing list