Forced some delay in server shutdown to give time the ProcessorEvent to shutdown correclty (it's asynch operation)
This commit is contained in:
@@ -2,6 +2,7 @@ package org.dna.mqtt.moquette.server;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import org.dna.mqtt.moquette.messaging.spi.impl.SimpleMessaging;
|
||||
//import org.dna.mqtt.moquette.server.mina.MinaAcceptor;
|
||||
import org.dna.mqtt.moquette.server.netty.NettyAcceptor;
|
||||
@@ -44,10 +45,19 @@ public class Server {
|
||||
m_acceptor.initialize(messaging);
|
||||
}
|
||||
|
||||
/**
|
||||
* It's an asynchronous method, it's only a request to stop
|
||||
*/
|
||||
public void stopServer() {
|
||||
System.out.println("Server stopping...");
|
||||
messaging.stop();
|
||||
m_acceptor.close();
|
||||
System.out.println("Server stopped");
|
||||
try {
|
||||
//sleep one second to give the disruptor
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ex) {
|
||||
LOG.error(null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user