[ 
https://issues.apache.org/jira/browse/MAPREDUCE-5428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13722825#comment-13722825
 ] 

Karthik Kambatla commented on MAPREDUCE-5428:
---------------------------------------------

I think something simple like the following should work:

{code}

  @Override
  public void serviceStop() throws Exception {
    moveToDoneExecutor.shutdown();
    moveToDoneExecutor.awaitTermination(3, TimeUnit.SECONDS);
    if (!moveToDoneExecutor.isTerminated()) {
      moveToDoneExecutor.shutdownNow();
      moveToDoneExecutor.awaitTermination(3, TimeUnit.SECONDS);
    }
    super.serviceStop();
  }
{code}


However, I wonder if it is a good idea to add a util class or methods in 
{{AbstractService}} to shutdown Runnables/Executors, so we can have a single 
default timeout for similar shutdowns in all services.
                
> HistoryFileManager doesn't stop threads when service is stopped
> ---------------------------------------------------------------
>
>                 Key: MAPREDUCE-5428
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-5428
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>          Components: jobhistoryserver, mrv2
>    Affects Versions: 2.0.4-alpha
>            Reporter: Jason Lowe
>            Assignee: Karthik Kambatla
>
> HistoryFileManager is a service that starts threads, but it does not override 
> the serviceStop method to stop the threads when the service is stopped.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to