[jbosscache-issues] [JBoss JIRA] (JBCACHE-1585) JBossCache eviction thread creating a Timer without making the new thread a daemon thread

Luc Boudreau (Commented) (JIRA) jira-events at lists.jboss.org
Thu Oct 6 19:08:16 EDT 2011


    [ https://issues.jboss.org/browse/JBCACHE-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632923#comment-12632923 ] 

Luc Boudreau commented on JBCACHE-1585:
---------------------------------------

I believe this is also impacting the Infinispan project. We observed the same problem with it. The JVM won't shutdown gracefully when using Infinispan / JBoss Cache.
                
> JBossCache eviction thread creating a Timer without making the new thread a daemon thread
> -----------------------------------------------------------------------------------------
>
>                 Key: JBCACHE-1585
>                 URL: https://issues.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:
>          evictionThread_ = new Timer();
> 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:
>          evictionThread_ = new Timer(true);
> 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, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosscache-issues mailing list