Commit e311fd68 authored by Tom Evans's avatar Tom Evans

OF-771: Ensure proper shutdown for MUC module

When the server is shutting down, messages to persistent MUC rooms
should be written to the DB.
parent a26c4756
...@@ -365,7 +365,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService ...@@ -365,7 +365,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
} }
public void shutdown() { public void shutdown() {
stop();
} }
public String getServiceDomain() { public String getServiceDomain() {
...@@ -1052,7 +1052,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService ...@@ -1052,7 +1052,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
} }
} }
public void stop() { private void stop() {
XMPPServer.getInstance().getIQDiscoItemsHandler().removeServerItemsProvider(this); XMPPServer.getInstance().getIQDiscoItemsHandler().removeServerItemsProvider(this);
XMPPServer.getInstance().getIQDiscoInfoHandler().removeServerNodeInfoProvider(this.getServiceDomain()); XMPPServer.getInstance().getIQDiscoInfoHandler().removeServerNodeInfoProvider(this.getServiceDomain());
XMPPServer.getInstance().getServerItemsProviders().remove(this); XMPPServer.getInstance().getServerItemsProviders().remove(this);
...@@ -1067,10 +1067,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService ...@@ -1067,10 +1067,7 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
// Do nothing if the service status has not changed // Do nothing if the service status has not changed
return; return;
} }
XMPPServer server = XMPPServer.getInstance();
if (!enabled) { if (!enabled) {
// Disable disco information
server.getIQDiscoItemsHandler().removeServerItemsProvider(this);
// Stop the service/module // Stop the service/module
stop(); stop();
} }
...@@ -1081,8 +1078,6 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService ...@@ -1081,8 +1078,6 @@ public class MultiUserChatServiceImpl implements Component, MultiUserChatService
if (enabled) { if (enabled) {
// Start the service/module // Start the service/module
start(); start();
// Enable disco information
server.getIQDiscoItemsHandler().addServerItemsProvider(this);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment