Minor, removed MapDB shutdown hook because it's responsibility of the Moquette shutdown hook to teardown the storage
This commit is contained in:
@@ -124,7 +124,10 @@ public class SimpleMessaging implements IMessaging, EventHandler<ValueEvent> {
|
|||||||
disruptorPublish(new StopEvent());
|
disruptorPublish(new StopEvent());
|
||||||
try {
|
try {
|
||||||
//wait the callback notification from the protocol processor thread
|
//wait the callback notification from the protocol processor thread
|
||||||
|
LOG.debug("waiting 10 sec to m_stopLatch");
|
||||||
boolean elapsed = !m_stopLatch.await(10, TimeUnit.SECONDS);
|
boolean elapsed = !m_stopLatch.await(10, TimeUnit.SECONDS);
|
||||||
|
LOG.debug("after m_stopLatch");
|
||||||
|
m_executor.shutdown();
|
||||||
if (elapsed) {
|
if (elapsed) {
|
||||||
LOG.error("Can't stop the server in 10 seconds");
|
LOG.error("Can't stop the server in 10 seconds");
|
||||||
}
|
}
|
||||||
@@ -181,9 +184,8 @@ public class SimpleMessaging implements IMessaging, EventHandler<ValueEvent> {
|
|||||||
private void processStop() {
|
private void processStop() {
|
||||||
LOG.debug("processStop invoked");
|
LOG.debug("processStop invoked");
|
||||||
m_storageService.close();
|
m_storageService.close();
|
||||||
|
|
||||||
// m_eventProcessor.halt();
|
// m_eventProcessor.halt();
|
||||||
m_executor.shutdown();
|
// m_executor.shutdown();
|
||||||
|
|
||||||
subscriptions = null;
|
subscriptions = null;
|
||||||
m_stopLatch.countDown();
|
m_stopLatch.countDown();
|
||||||
|
|||||||
+2
-3
@@ -65,7 +65,6 @@ public class MapDBPersistentStore implements IMessagesStore, ISessionsStore {
|
|||||||
throw new MQTTException("Can't create temp file for subscriptions storage [" + STORAGE_FILE_PATH + "]", ex);
|
throw new MQTTException("Can't create temp file for subscriptions storage [" + STORAGE_FILE_PATH + "]", ex);
|
||||||
}
|
}
|
||||||
m_db = DBMaker.newFileDB(tmpFile)
|
m_db = DBMaker.newFileDB(tmpFile)
|
||||||
.closeOnJvmShutdown()
|
|
||||||
.make();
|
.make();
|
||||||
m_retainedStore = m_db.getHashMap("retained");
|
m_retainedStore = m_db.getHashMap("retained");
|
||||||
m_persistentMessageStore = m_db.getHashMap("persistedMessages");
|
m_persistentMessageStore = m_db.getHashMap("persistedMessages");
|
||||||
@@ -219,9 +218,9 @@ public class MapDBPersistentStore implements IMessagesStore, ISessionsStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
LOG.debug("closing disk storage");
|
|
||||||
this.m_db.commit();
|
this.m_db.commit();
|
||||||
// this.m_db.close(); this is done by the Shutdown hook into MapDB
|
this.m_db.close();
|
||||||
|
LOG.debug("closed disk storage");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------- QoS 2 storage management --------------*/
|
/*-------- QoS 2 storage management --------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user