[
https://jira.jboss.org/jira/browse/JBREM-1125?page=com.atlassian.jira.plu...
]
Trustin Lee commented on JBREM-1125:
------------------------------------
According to the java.util.Timer javadoc:
'After the last live reference to a Timer object goes away and all outstanding tasks
have completed execution, the timer's task execution thread terminates gracefully (and
becomes subject to garbage collection). However, this can take arbitrarily long to occur.
By default, the task execution thread does not run as a daemon thread, so it is capable of
keeping an application from terminating. If a caller wants to terminate a timer's task
execution thread rapidly, the caller should invoke the the timer's cancel
method.'
So, could we retain the reference to the Timer instance to prevent the thread termination
until the Remoting is shut down? Catching IllegalStateException and recreating a Timer
sounds like a sort of hack.
Test for IllegalStateException when calling Timer.schedule()
------------------------------------------------------------
Key: JBREM-1125
URL:
https://jira.jboss.org/jira/browse/JBREM-1125
Project: JBoss Remoting
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 2.2.2.SP11, 2.5.1 (Flounder)
Reporter: Ron Sigal
Assignee: Ron Sigal
Fix For: 2.2.2.SP12, 2.5.2 (Flounder)
When a java.util.Timer has not more TimerTasks in its queue, it can shut itself down, so
that subsequent calls to Timer.schedule() will throw a java.lang.IllegalStateException.
Therefore, all calls to Timer.schedule() should be inside a try/catch block that will
catch IllegalStateExceptions and create a new Timer. Most of these calls in Remoting are
already protected, but there are a couple that are not. In particuler,
branch 2.2:
========
* org.jboss.remoting.detection.AbstractDetector.startHeartbeat()
* org.jboss.remoting.util.TimerUtil.schedule()
branch 2.x:
========
* org.jboss.remoting.detection.AbstractDetector.startHeartbeat()
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira