diff --git a/io.openems.edge.bridge.http/src/io/openems/edge/bridge/http/BridgeHttpImpl.java b/io.openems.edge.bridge.http/src/io/openems/edge/bridge/http/BridgeHttpImpl.java index 460236c183..3725194c43 100644 --- a/io.openems.edge.bridge.http/src/io/openems/edge/bridge/http/BridgeHttpImpl.java +++ b/io.openems.edge.bridge.http/src/io/openems/edge/bridge/http/BridgeHttpImpl.java @@ -229,10 +229,8 @@ private void handleEvent(Event event) { final var item = this.cycleEndpoints.poll(); synchronized (item) { if (item.isRunning()) { - this.log.info( - "Process for " + item.cycleEndpoint + " is still running. Task is not queued twice"); if (!this.cycleEndpoints.offer(item.resetTo(1))) { - this.log.info("Unable to re-add " + item + " to queue again."); + this.log.warn("Unable to re-add " + item + " to queue again."); } continue; } @@ -298,14 +296,19 @@ private Runnable createTask(TimeEndpointCountdown endpointCountdown) { nextDelay = endpointCountdown.getTimeEndpoint().delayTimeProvider().onSuccessRunDelay(result); } - // TODO change in java 21 to switch case - if (nextDelay instanceof Delay.InfiniteDelay) { + switch (nextDelay) { + case Delay.InfiniteDelay infiniteDelay -> { // do not queue again return; - } else if (nextDelay instanceof Delay.DurationDelay durationDelay) { + } + case Delay.DurationDelay durationDelay -> { final var future = this.pool.schedule(this.createTask(endpointCountdown), durationDelay); endpointCountdown.setShutdownCurrentTask(() -> future.cancel(false)); } + default -> { + this.log.warn("Unhandled Delay type: " + nextDelay.getClass().getName()); + } + } } catch (Exception e) { if (this.pool.isShutdown()) { @@ -334,5 +337,4 @@ public Collection removeCycleEndpointIf(Predicate .map(CycleEndpointCountdown::getCycleEndpoint) // .toList(); } - }