Skip to content
Permalink
Browse files

reset the shuttingDown flag when clearing the ShutDownManager

  • Loading branch information...
pabender committed Jun 13, 2019
1 parent f0dc184 commit 4c70fd0349832873ce7bd6206d79802b497b449c
Showing with 12 additions and 0 deletions.
  1. +1 −0 java/test/apps/LaunchJmriAppBase.java
  2. +11 −0 java/test/jmri/util/JUnitUtil.java
@@ -109,6 +109,7 @@ public void setUp() {

@After
public void tearDown() {
JUnitUtil.clearShutDownManager();
JUnitUtil.tearDown();
}

@@ -908,6 +908,17 @@ public static void clearShutDownManager() {
sm.deregister(list.get(0));
list = sm.tasks(); // avoid ConcurrentModificationException
}

// use reflection to reset static fields in the class.
try {
Class<?> c = jmri.managers.DefaultShutDownManager.class;
java.lang.reflect.Field f = c.getDeclaredField("shuttingDown");
f.setAccessible(true);
f.set(sm, false);
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException x) {
log.error("Failed to reset DefaultShutDownManager shuttingDown field", x);
}

}

/**

0 comments on commit 4c70fd0

Please sign in to comment.
You can’t perform that action at this time.