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

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

* I2PAppContext: Improved synching in constructor

parent d80340f0
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,7 @@ import net.i2p.util.I2PProperties.I2PPropertyCallback; ...@@ -64,7 +64,7 @@ import net.i2p.util.I2PProperties.I2PPropertyCallback;
* contexts should build their own context as soon as possible (within the main(..)) * contexts should build their own context as soon as possible (within the main(..))
* so that any referenced components will latch on to that context instead of * so that any referenced components will latch on to that context instead of
* instantiating a new one. However, there are situations in which both can be * instantiating a new one. However, there are situations in which both can be
* relevent. * relevant.
* *
*/ */
public class I2PAppContext { public class I2PAppContext {
...@@ -196,16 +196,7 @@ public class I2PAppContext { ...@@ -196,16 +196,7 @@ public class I2PAppContext {
* Will only apply if there is no global context now. * Will only apply if there is no global context now.
*/ */
private I2PAppContext(boolean doInit, Properties envProps) { private I2PAppContext(boolean doInit, Properties envProps) {
if (doInit) { synchronized (I2PAppContext.class) {
synchronized (I2PAppContext.class) {
if (_globalAppContext == null) {
_globalAppContext = this;
} else {
System.out.println("Warning - New context not replacing old one, you now have a second one");
(new Exception("I did it")).printStackTrace();
}
}
}
_overrideProps = new I2PProperties(); _overrideProps = new I2PProperties();
if (envProps != null) if (envProps != null)
_overrideProps.putAll(envProps); _overrideProps.putAll(envProps);
...@@ -319,6 +310,16 @@ public class I2PAppContext { ...@@ -319,6 +310,16 @@ public class I2PAppContext {
System.err.println("PID directory: " + _pidDir.getAbsolutePath()); System.err.println("PID directory: " + _pidDir.getAbsolutePath());
System.err.println("Temp directory: " + getTempDir().getAbsolutePath()); System.err.println("Temp directory: " + getTempDir().getAbsolutePath());
******/ ******/
if (doInit) {
if (_globalAppContext == null) {
_globalAppContext = this;
} else {
System.out.println("Warning - New context not replacing old one, you now have a second one");
(new Exception("I did it")).printStackTrace();
}
}
} // synch
} }
/** /**
......
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