Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public boolean shutdownNow()
}
catch ( InterruptedException e )
{
Thread.currentThread().interrupt();
logger.warn( "Interrupted while shutting down connection manager cache." );
}

Expand All @@ -125,28 +126,33 @@ private synchronized boolean doShutdown( Function<ConnectionManagerTracker, Bool
return t;
} );

ExecutorCompletionService<Boolean> svc = new ExecutorCompletionService<>( exec );
cache.forEach( ( config, tracker ) -> svc.submit( () -> shutdownAction.apply( tracker ) ) );

boolean result = true;
while ( counter.getAndDecrement() > 0 )
try
{
try
{
result = result && svc.take().get();
}
catch ( ExecutionException e )
ExecutorCompletionService<Boolean> svc = new ExecutorCompletionService<>( exec );
int submitted = cache.size();
cache.values().forEach( tracker -> svc.submit( () -> shutdownAction.apply( tracker ) ) );
boolean result = true;
for ( int i = 0; i < submitted; i++ )
{
logger.warn( "Error executing shutdown of connection managers." );
result = false;
try
{
boolean shutDown = svc.take().get();
result = result && shutDown;
}
catch ( ExecutionException e )
{
logger.warn( "Error executing shutdown of connection managers.", e );
result = false;
}
}
}

timer.cancel();
shutdown = true;
cache.clear();

return result;
return result;
}
finally
{
exec.shutdown();
timer.cancel();
}
}

@Override
Expand Down