Stop the web interface when the plugin is stopped.
[Sone.git] / src / main / java / net / pterodactylus / sone / main / SonePlugin.java
index 5bc32e8..60812cd 100644 (file)
@@ -37,6 +37,7 @@ import freenet.l10n.PluginL10n;
 import freenet.pluginmanager.FredPlugin;
 import freenet.pluginmanager.FredPluginBaseL10n;
 import freenet.pluginmanager.FredPluginL10n;
+import freenet.pluginmanager.FredPluginThreadless;
 import freenet.pluginmanager.PluginRespirator;
 
 /**
@@ -45,7 +46,7 @@ import freenet.pluginmanager.PluginRespirator;
  *
  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
-public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10n {
+public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10n, FredPluginThreadless {
 
        static {
                /* initialize logging. */
@@ -61,6 +62,9 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10
        /** The core. */
        private Core core;
 
+       /** The web interface. */
+       private WebInterface webInterface;
+
        /** The l10n helper. */
        private PluginL10n l10n;
 
@@ -124,7 +128,7 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10
                FreenetInterface freenetInterface = new FreenetInterface(pluginRespirator.getNode(), pluginRespirator.getHLSimpleClient());
 
                /* create the web interface. */
-               WebInterface webInterface = new WebInterface(this);
+               webInterface = new WebInterface(this);
 
                /* create core. */
                core = new Core();
@@ -141,6 +145,9 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10
         */
        @Override
        public void terminate() {
+               /* stop the web interface. */
+               webInterface.stop();
+
                /* stop the core. */
                core.stop();