add timeout to shutdown handler, change timout for btc network connection lost

This commit is contained in:
Manfred Karrer 2015-05-22 16:40:55 +02:00
parent a57f246a0c
commit a0e7a80bfc
4 changed files with 11 additions and 5 deletions

View file

@ -68,6 +68,7 @@ import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
@ -280,7 +281,12 @@ public class WalletService {
wallet.removeEventListener(walletEventListener);
if (walletAppKit != null) {
walletAppKit.stopAsync();
walletAppKit.awaitTerminated();
try {
walletAppKit.awaitTerminated(5, TimeUnit.SECONDS);
} catch (TimeoutException e) {
e.printStackTrace();
log.error("walletAppKit.awaitTerminated not terminated after 5 sec. Error message: " + e.getMessage());
}
}
}

View file

@ -157,7 +157,7 @@ public final class Node {
public String toString() {
return "Name='" + name + '\'' +
"; IP='" + ip + '\'' +
"; P2P network ID=" + p2pId +
"; port=" + port;
"; port=" + port +
"; P2P network ID=" + p2pId;
}
}