broker/Server: ScheduledExecutorService moved from MapDBPersistentStore

broker/ProtocolProcessorBootstrapper: tabs removed
broker/MapDBPersistentStore: bonding to Server removed
This commit is contained in:
Andreas Mager
2017-03-22 23:16:14 +01:00
committed by Andreas Mager
parent 6ca8108f1e
commit dd106434ce
4 changed files with 39 additions and 16 deletions
@@ -45,6 +45,9 @@ import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import static io.moquette.logging.LoggingUtils.getInterceptorIds;
/**
@@ -68,6 +71,8 @@ public class Server {
private ProtocolProcessorBootstrapper m_processorBootstrapper;
private ScheduledExecutorService scheduler;
public static void main(String[] args) throws IOException {
final Server server = new Server();
server.startServer();
@@ -172,6 +177,8 @@ public class Server {
}
LOG.info("Starting Moquette Server. MQTT message interceptors = {}.", getInterceptorIds(handlers));
scheduler = Executors.newScheduledThreadPool(1);
final String handlerProp = System.getProperty(BrokerConstants.INTERCEPT_HANDLER_PROPERTY_NAME);
if (handlerProp != null) {
config.setProperty(BrokerConstants.INTERCEPT_HANDLER_PROPERTY_NAME, handlerProp);
@@ -270,6 +277,9 @@ public class Server {
LOG.warn("The embedded Hazelcast instance is already shut down.");
}
}
scheduler.shutdown();
LOG.info("The Moquette server has been stopped.");
}
@@ -332,4 +342,8 @@ public class Server {
public ProtocolProcessor getProcessor() {
return m_processor;
}
public ScheduledExecutorService getScheduler() {
return scheduler;
}
}