PeerGroup: Log shutdown times.

This commit is contained in:
Andreas Schildbach
2018-04-16 18:48:57 +02:00
parent 6764430b5b
commit 9cede7a7e6

View File

@@ -1082,6 +1082,7 @@ public class PeerGroup implements TransactionBroadcaster {
public void run() {
try {
log.info("Stopping ...");
Stopwatch watch = Stopwatch.createStarted();
// Blocking close of all sockets.
channels.stopAsync();
channels.awaitTerminated();
@@ -1089,7 +1090,7 @@ public class PeerGroup implements TransactionBroadcaster {
peerDiscovery.shutdown();
}
vRunning = false;
log.info("Stopped.");
log.info("Stopped, took {}.", watch);
} catch (Throwable e) {
log.error("Exception when shutting down", e); // The executor swallows exceptions :(
}
@@ -1102,9 +1103,11 @@ public class PeerGroup implements TransactionBroadcaster {
/** Does a blocking stop */
public void stop() {
try {
Stopwatch watch = Stopwatch.createStarted();
stopAsync();
log.info("Awaiting PeerGroup shutdown ...");
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
log.info("... took {}", watch);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}