[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-492) FSMasterDirectoryProvider and FSSlaveDirectoryProvider don't shutdown the Executor

Sanne Grinovero (JIRA) noreply at atlassian.com
Tue Apr 6 17:37:09 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=36193#action_36193 ] 

Sanne Grinovero commented on HSEARCH-492:
-----------------------------------------

why are you giving it a 20 seconds ultimatum before kill?
I was thinking to use just executor.shutdown() , and if eventually a copy is being made it will get whatever time it takes to finish properly.


> FSMasterDirectoryProvider and FSSlaveDirectoryProvider don't shutdown the Executor
> ----------------------------------------------------------------------------------
>
>                 Key: HSEARCH-492
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-492
>             Project: Hibernate Search
>          Issue Type: Bug
>          Components: directory provider
>    Affects Versions: 3.1.1.GA
>         Environment: Java 1.6.0
>            Reporter: Sylvain Charton
>            Priority: Minor
>             Fix For: 3.2.0.CR1
>
>
> I'm using Hibernate Search clustering feature in a stand alone Java application (not a webapp). 
> My problem is the application never stops: many threads are still living.
> Both FSMasterDirectoryProvider and FSSlaveDirectoryProvider use a Single Thread Executor to perform the CopyTask. 
> When the FSSlaveDirectoryProvider.stop() is called, the timer is stopped, but not the Executor in the TimerTask. 
> Consequence is the process can't stop, because some threads are still living, endlessly. 
> This happens after the first CopyDirectory task was executed. 
> My fix was to copy this class in my code, and replace the Executor in TriggerTask class by an ExecutorService in FSSlaveDirectoryProvider class. 
> The ExecutorService is initialized in the start() method:
> {code:Java}this.executor = Executors.newSingleThreadExecutor() ;{code}
> And properly shut down in the stop() method:
> {code:java}
> executor.shutdown();
> boolean terminated = false ;
> try{
>   terminated = executor.awaitTermination(20, TimeUnit.SECONDS);
> } catch (InterruptedException e1) {
>   terminated = false ;
> }
> if (!terminated) {
>   executor.shutdownNow() ;
> }
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list