Github user chtyim commented on a diff in the pull request:

    https://github.com/apache/twill/pull/2#discussion_r75569082
  
    --- Diff: 
twill-core/src/main/java/org/apache/twill/internal/TwillContainerLauncher.java 
---
    @@ -177,7 +188,24 @@ protected void doStartUp() {
     
         @Override
         protected void doShutDown() {
    -      // No-op
    +      // Wait for sometime for the container to stop
    +      // TODO: Use configurable value for stop time
    +      int maxWaitSecs = Constants.APPLICATION_MAX_STOP_SECONDS;
    +      try {
    +        if (shutdownLatch.await(maxWaitSecs, TimeUnit.SECONDS)) {
    +          return;
    +        }
    +      } catch (InterruptedException e) {
    +        LOG.error("Got exception while waiting for runnable {}, instance 
{} to stop", runnable, instanceId);
    --- End diff --
    
    I think it's better to ignore the interrupted exception, or at least clear 
the thread interrupt flag before calling `await`. This is because
    
    1. you are not blocking forever anyway
    2. we do want to spend max effort to let the contain finish it's job before 
it gets killed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to