I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit e31c0636 authored by zzz's avatar zzz
Browse files

- Implement destroy() in addressbook to prevent dups

parent e9fe80f8
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,7 @@ import net.i2p.I2PAppContext;
public class Daemon {
public static final String VERSION = "2.0.3";
private static final Daemon _instance = new Daemon();
private boolean _running;
/**
* Update the router and published address books using remote data from the
......@@ -126,6 +127,7 @@ public class Daemon {
}
public void run(String[] args) {
_running = true;
String settingsLocation = "config.txt";
File homeFile;
if (args.length > 0) {
......@@ -166,7 +168,7 @@ public class Daemon {
// Static method, and redundent Thread.currentThread().sleep(5*60*1000);
} catch (InterruptedException ie) {}
while (true) {
while (_running) {
long delay = Long.parseLong((String) settings.get("update_delay"));
if (delay < 1) {
delay = 1;
......@@ -179,6 +181,8 @@ public class Daemon {
}
} catch (InterruptedException exp) {
}
if (!_running)
break;
settings = ConfigParser.parse(settingsFile, defaultSettings);
}
}
......@@ -192,4 +196,9 @@ public class Daemon {
_instance.notifyAll();
}
}
public static void stop() {
_instance._running = false;
wakeup();
}
}
......@@ -51,4 +51,9 @@ public class DaemonThread extends Thread {
//}
Daemon.main(this.args);
}
}
\ No newline at end of file
public void halt() {
Daemon.stop();
interrupt();
}
}
......@@ -41,7 +41,7 @@ import javax.servlet.http.HttpServletResponse;
*
*/
public class Servlet extends HttpServlet {
private Thread thread;
private DaemonThread thread;
private String nonce;
private static final String PROP_NONCE = "addressbook.nonce";
......@@ -88,4 +88,9 @@ public class Servlet extends HttpServlet {
//System.out.println("INFO: config root under " + args[0]);
}
@Override
public void destroy() {
this.thread.halt();
super.destroy();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment