Skip to content

Commit

Permalink
Issue #4321 Refactored Graceful shutdown
Browse files Browse the repository at this point in the history
after review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
  • Loading branch information
gregw committed Jan 29, 2020
1 parent 2d17882 commit 0d4eaaf
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -466,18 +466,18 @@ protected void doStop() throws Exception

if (getStopTimeout() > 0)
{
long end = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(getStopTimeout());
try
{
long end = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(getStopTimeout());
Graceful.shutdown(this).get(getStopTimeout(), TimeUnit.MILLISECONDS);
QueuedThreadPool qtp = getBean(QueuedThreadPool.class);
if (qtp != null)
qtp.setStopTimeout(Math.min(1000L, TimeUnit.NANOSECONDS.toMillis(end - System.nanoTime())));
}
catch (Throwable e)
{
mex.add(e);
}
QueuedThreadPool qtp = getBean(QueuedThreadPool.class);
if (qtp != null)
qtp.setStopTimeout(Math.max(1000L, TimeUnit.NANOSECONDS.toMillis(end - System.nanoTime())));
}

// Now stop the connectors (this will close existing connections)
Expand Down

0 comments on commit 0d4eaaf

Please sign in to comment.