[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/transport/bisocket ...
Ron Sigal
ron_sigal at yahoo.com
Sat Jul 21 02:30:05 EDT 2007
User: rsigal
Date: 07/07/21 02:30:05
Modified: src/main/org/jboss/remoting/transport/bisocket Tag:
remoting_2_2_0_SP4_CP BisocketServerInvoker.java
Log:
JBREM-778: Creates new TImer in start() only when necessary.
Revision Changes Path
No revision
No revision
1.1.2.17.2.2.2.1 +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.2
retrieving revision 1.1.2.17.2.2.2.1
diff -u -b -r1.1.2.17.2.2 -r1.1.2.17.2.2.2.1
--- BisocketServerInvoker.java 3 May 2007 21:48:10 -0000 1.1.2.17.2.2
+++ BisocketServerInvoker.java 21 Jul 2007 06:30:05 -0000 1.1.2.17.2.2.2.1
@@ -58,7 +58,7 @@
/**
*
* @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Revision: 1.1.2.17.2.2 $
+ * @version $Revision: 1.1.2.17.2.2.2.1 $
* <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