[jbosscache-issues] [JBoss JIRA] Created: (JBCACHE-1585) JBossCache eviction thread creating a Timer without making the new thread a daemon thread
Mats Henrikson (JIRA)
jira-events at lists.jboss.org
Thu Jun 24 00:48:48 EDT 2010
JBossCache eviction thread creating a Timer without making the new thread a daemon thread
-----------------------------------------------------------------------------------------
Key: JBCACHE-1585
URL: https://jira.jboss.org/browse/JBCACHE-1585
Project: JBoss Cache
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 1.4.1.SP13
Reporter: Mats Henrikson
Assignee: Manik Surtani
There is a problem where the class org.jboss.cache.eviction.RegionManager.EvictionTreeCacheListener.cacheStarted(), line 499:
{code}
evictionThread_ = new Timer();
{code}
Since the new Timer() is created without telling it that it is a daemon thread this Timer thread will actually cause the JVM to not exit when the main() method of the application finishes - it makes it necessary to call System.exit() to shut the JVM down.
Since this is the thread that periodically runs the specified eviction policy there is no need for it to cause the JVM to stay running - it's up to the developer to say if the JVM should stay running or not, not JBossCache.
The line should be changed to something like:
{code}
evictionThread_ = new Timer(true);
{code}
in order to specify that this is a daemon thread. (At the same time it would also be good if the Timer is passed a thread name like for instance "JBossCache Eviction Thread".)
Please see the JDK docs for more info:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Timer.html#Timer(java.lang.String,%20boolean)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jbosscache-issues
mailing list