Improve close connection and shutdown handling

This commit is contained in:
Manfred Karrer 2016-02-02 21:07:45 +01:00
parent 16f014adb6
commit 85b2cb1d44
19 changed files with 220 additions and 188 deletions

View file

@ -28,13 +28,14 @@ public class Version {
// The version nr. for the objects sent over the network. A change will break the serialization of old objects.
// If objects are used for both network and database the network version is applied.
public static final long NETWORK_PROTOCOL_VERSION = 1;
public static final long NETWORK_PROTOCOL_VERSION = 2;
// The version nr. of the serialized data stored to disc. A change will break the serialization of old objects.
public static final long LOCAL_DB_VERSION = 1;
public static final long LOCAL_DB_VERSION = 2;
// The version nr. of the current protocol. The offer holds that version. A taker will check the version of the offers to see if he his version is
// compatible.
// The version nr. of the current protocol. The offer holds that version.
// A taker will check the version of the offers to see if his version is compatible.
// TODO not used yet
public static final long PROTOCOL_VERSION = 1;
// The version for the bitcoin network (Mainnet = 0, TestNet = 1, Regtest = 2)

View file

@ -73,7 +73,9 @@ public class Utilities {
ThreadPoolExecutor executor = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTimeInSec,
TimeUnit.SECONDS, new ArrayBlockingQueue<>(maximumPoolSize), threadFactory);
executor.allowCoreThreadTimeOut(true);
executor.setRejectedExecutionHandler((r, e) -> log.warn("RejectedExecutionHandler called"));
executor.setRejectedExecutionHandler((r, e) -> {
log.warn("RejectedExecutionHandler called");
});
return executor;
}
@ -92,7 +94,9 @@ public class Utilities {
executor.allowCoreThreadTimeOut(true);
executor.setMaximumPoolSize(maximumPoolSize);
executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
executor.setRejectedExecutionHandler((r, e) -> log.debug("RejectedExecutionHandler called"));
executor.setRejectedExecutionHandler((r, e) -> {
log.warn("RejectedExecutionHandler called");
});
return executor;
}