aboutsummaryrefslogtreecommitdiffstats
path: root/feature-lifecycle/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'feature-lifecycle/src/main/java/org')
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java
index 36d2a545..5b4bd1ec 100644
--- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java
+++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
+import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@@ -85,7 +86,7 @@ public class LifecycleFsm implements Startable {
protected volatile LifecycleState state = new LifecycleStateTerminated(this);
@GsonJsonIgnore
- protected ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(1);
+ protected ScheduledExecutorService scheduler = makeExecutor();
@GsonJsonIgnore
protected ScheduledFuture<?> statusTask;
@@ -118,10 +119,6 @@ public class LifecycleFsm implements Startable {
*/
public LifecycleFsm() {
this.properties = SystemPersistenceConstants.getManager().getProperties(CONFIGURATION_PROPERTIES_NAME);
-
- scheduler.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
- scheduler.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
- scheduler.setRemoveOnCancelPolicy(true);
}
@Override
@@ -476,4 +473,15 @@ public class LifecycleFsm implements Startable {
return fsm.isItMe(update.getName(), update.getPdpGroup(), update.getPdpSubgroup());
}
}
+
+ // these may be overridden by junit tests
+
+ protected ScheduledExecutorService makeExecutor() {
+ ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor(1);
+ exec.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
+ exec.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
+ exec.setRemoveOnCancelPolicy(true);
+
+ return exec;
+ }
}