mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-30 19:41:24 +00:00
PeerGroup: Log shutdown times.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user