Browse Source
Merge pull request #9094 from smatvienko-tb/feature/math_node_code_cleanup
TbMathNode code cleanup
pull/9144/head
Andrew Shvayka
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
0 additions and
12 deletions
-
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/math/TbMathNode.java
|
|
|
@ -50,7 +50,6 @@ import java.util.Queue; |
|
|
|
import java.util.concurrent.ConcurrentLinkedQueue; |
|
|
|
import java.util.concurrent.ConcurrentMap; |
|
|
|
import java.util.concurrent.Semaphore; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.function.BiFunction; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
@ -174,17 +173,6 @@ public class TbMathNode implements TbNode { |
|
|
|
return resultMsgFuture; |
|
|
|
} |
|
|
|
|
|
|
|
private boolean tryAcquire(EntityId originator, Semaphore originatorSemaphore) { |
|
|
|
boolean acquired; |
|
|
|
try { |
|
|
|
acquired = originatorSemaphore.tryAcquire(20, TimeUnit.SECONDS); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
acquired = false; |
|
|
|
log.debug("[{}] Failed to acquire semaphore", originator, e); |
|
|
|
} |
|
|
|
return acquired; |
|
|
|
} |
|
|
|
|
|
|
|
private ListenableFuture<TbMsg> updateMsgAndDb(TbContext ctx, TbMsg msg, Optional<ObjectNode> msgBodyOpt, double result) { |
|
|
|
TbMathResult mathResultDef = config.getResult(); |
|
|
|
switch (mathResultDef.getType()) { |
|
|
|
|