refactoring

pull/578/head^2
Nikita 9 years ago
parent 03ae325c75
commit f184d91eff

@ -54,26 +54,24 @@ public class RedissonNode {
} }
} }
if (config.getExecutorServiceWorkers().isEmpty()) {
throw new IllegalArgumentException("Executor service workers are empty");
}
start(config); start(config);
} }
public static void start(RedissonNodeConfig config) { public static void start(RedissonNodeConfig config) {
final RedissonClient redisson = Redisson.create(config); if (config.getExecutorServiceWorkers().isEmpty()) {
throw new IllegalArgumentException("Executor service workers are empty");
}
final ExecutorService executor; final ExecutorService executor;
if (config.getExecutorServiceThreads() != -1) {
if (config.getExecutorServiceThreads() == 0) { if (config.getExecutorServiceThreads() == 0) {
executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2); executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
} else { } else if (config.getExecutorServiceThreads() > 0) {
executor = Executors.newFixedThreadPool(config.getExecutorServiceThreads()); executor = Executors.newFixedThreadPool(config.getExecutorServiceThreads());
}
} else { } else {
executor = null; executor = null;
} }
final RedissonClient redisson = Redisson.create(config);
for (Entry<String, Integer> entry : config.getExecutorServiceWorkers().entrySet()) { for (Entry<String, Integer> entry : config.getExecutorServiceWorkers().entrySet()) {
String name = entry.getKey(); String name = entry.getKey();
int workers = entry.getValue(); int workers = entry.getValue();

Loading…
Cancel
Save