Skip to content

Commit 6aa760e

Browse files
committed
Merge pull request #3588 from zsxwing/init-order
Fix the initialization order in GenericScheduledExecutorService
2 parents 884e49b + 97dbfed commit 6aa760e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main/java/rx/internal/schedulers/GenericScheduledExecutorService.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ public final class GenericScheduledExecutorService implements SchedulerLifecycle
3535

3636
private static final String THREAD_NAME_PREFIX = "RxScheduledExecutorPool-";
3737
private static final RxThreadFactory THREAD_FACTORY = new RxThreadFactory(THREAD_NAME_PREFIX);
38-
39-
/* Schedulers needs acces to this in order to work with the lifecycle. */
40-
public final static GenericScheduledExecutorService INSTANCE = new GenericScheduledExecutorService();
41-
42-
private final AtomicReference<ScheduledExecutorService> executor;
43-
44-
static final ScheduledExecutorService NONE;
38+
39+
private static final ScheduledExecutorService NONE;
4540
static {
4641
NONE = Executors.newScheduledThreadPool(0);
4742
NONE.shutdownNow();
4843
}
44+
45+
/* Schedulers needs acces to this in order to work with the lifecycle. */
46+
public final static GenericScheduledExecutorService INSTANCE = new GenericScheduledExecutorService();
4947

48+
private final AtomicReference<ScheduledExecutorService> executor;
49+
5050
private GenericScheduledExecutorService() {
5151
executor = new AtomicReference<ScheduledExecutorService>(NONE);
5252
start();

0 commit comments

Comments
 (0)