Skip to content

Commit

Permalink
Conditionally use a thread pool backed sequential executor for DSL ru…
Browse files Browse the repository at this point in the history
…les and events

Signed-off-by: Jörg Sautter <[email protected]>
  • Loading branch information
joerg1985 committed Dec 7, 2023
1 parent 32237a9 commit 5cf06fe
Show file tree
Hide file tree
Showing 6 changed files with 681 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package org.openhab.core.automation.internal;

import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;

Expand All @@ -23,7 +22,7 @@
import org.openhab.core.automation.RuleStatusInfo;
import org.openhab.core.automation.Trigger;
import org.openhab.core.automation.handler.TriggerHandlerCallback;
import org.openhab.core.common.NamedThreadFactory;
import org.openhab.core.common.ThreadPoolManager;

/**
* This class is implementation of {@link TriggerHandlerCallback} used by the {@link Trigger}s to notify rule engine
Expand All @@ -48,7 +47,7 @@ public class TriggerHandlerCallbackImpl implements TriggerHandlerCallback {
protected TriggerHandlerCallbackImpl(RuleEngineImpl re, String ruleUID) {
this.re = re;
this.ruleUID = ruleUID;
executor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("rule-" + ruleUID));
this.executor = ThreadPoolManager.newSequentialScheduledExecutorService("rules-pool", "rule-" + ruleUID);
}

@Override
Expand Down
Loading

0 comments on commit 5cf06fe

Please sign in to comment.