Fix broken locking in Restarter.initialize
Closes gh-4955
This commit is contained in:
parent
c77a7e0cba
commit
4c1bb38878
|
|
@ -525,12 +525,16 @@ public class Restarter {
|
|||
public static void initialize(String[] args, boolean forceReferenceCleanup,
|
||||
RestartInitializer initializer, boolean restartOnInitialize,
|
||||
RestartListener... listeners) {
|
||||
if (instance == null) {
|
||||
synchronized (Restarter.class) {
|
||||
instance = new Restarter(Thread.currentThread(), args,
|
||||
Restarter localInstance = null;
|
||||
synchronized (Restarter.class) {
|
||||
if (instance == null) {
|
||||
localInstance = new Restarter(Thread.currentThread(), args,
|
||||
forceReferenceCleanup, initializer, listeners);
|
||||
instance = localInstance;
|
||||
}
|
||||
instance.initialize(restartOnInitialize);
|
||||
}
|
||||
if (localInstance != null) {
|
||||
localInstance.initialize(restartOnInitialize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue