mirror of
https://github.com/i2p/i2p.i2p.git
synced 2026-10-23 13:03:04 +00:00
* Router: Move addShutdownTask from Router to I2PAppContext
so that apps can register more easily
This commit is contained in:
1 parent
0d2812db50
commit
84bd8274ad
7 files changed
+34
-33
No files matched your search
@@ -23,6 +23,7 @@ import net.i2p.crypto.SessionKeyManager;
|
||||
import net.i2p.data.RoutingKeyGenerator;
|
||||
import net.i2p.stat.StatManager;
|
||||
import net.i2p.util.Clock;
|
||||
import net.i2p.util.ConcurrentHashSet;
|
||||
import net.i2p.util.FortunaRandomSource;
|
||||
import net.i2p.util.KeyRing;
|
||||
import net.i2p.util.LogManager;
|
||||
@@ -94,6 +95,7 @@ public class I2PAppContext {
|
||||
private volatile boolean _randomInitialized;
|
||||
private volatile boolean _keyGeneratorInitialized;
|
||||
protected volatile boolean _keyRingInitialized; // used in RouterContext
|
||||
private Set<Runnable> _shutdownTasks;
|
||||
|
||||
|
||||
/**
|
||||
@@ -152,6 +154,7 @@ public class I2PAppContext {
|
||||
_elGamalAESEngineInitialized = false;
|
||||
_logManagerInitialized = false;
|
||||
_keyRingInitialized = false;
|
||||
_shutdownTasks = new ConcurrentHashSet(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -557,4 +560,13 @@ public class I2PAppContext {
|
||||
_randomInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void addShutdownTask(Runnable task) {
|
||||
_shutdownTasks.add(task);
|
||||
}
|
||||
|
||||
public Set<Runnable> getShutdownTasks() {
|
||||
return new HashSet(_shutdownTasks);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user