Thread scheduled using scheduleWithFixedDelay() never executing under 2.5 snapshot

Tags: #<Tag:0x00007f1e5c214400>
(Bob Adair) #1

Hi. I recently got the Eclipse IDE working again for 2.5 development, and started doing some work on the Lutron binding. However, I soon noticed a problem with the current binding code running under 2.5. A routine which should be periodically executed by a thread scheduled using scheduleWithFixedDelay() is never being called. However, I can see the same code working on my 2.4 production system.

The problem schedule call is in at line 219:

private ScheduledFuture<?> keepAlive;


keepAlive = scheduler.scheduleWithFixedDelay(this::sendKeepAlive, heartbeatInterval, heartbeatInterval, TimeUnit.MINUTES);


private void sendKeepAlive() {

When I add logger calls or use the debugger, I can see that the scheduleWithFixedDelay call succeeds. At least so far that I get back a good java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask. The heartbeatInterval variable is set to 5 (minutes), and I confirmed immediately after this call that keepAlive.getDelay(TimeUnit.SECONDS) was 299 (seconds). But sendKeepAlive() is never called, and I can’t figure out why.

I tried running the binding both in the Eclipse IDE set up for 2.5 development with bnd and under the latest 2.5 snapshot build (or the latest as of a day or two ago, anyway) with the same results. That same bit of code has been working fine under 2.4, though.

I checked to see if the thingHandler thread pool was out of threads, but it looks fine. I set org.eclipse.smarthome.threadpool:thingHandler to 10, but there are only one or two threads running in it when I look.

Maybe I’m missing something obvious, but I can’t really think of what else to look at. Does anyone have any suggestions? Have there been any changes in 2.5 that would cause this sort of problem?


(Jan N. Klug) #2

I doubt that it is connected the migration, nothing has been changed then. I can‘t provide any more details but only confirm that scheduleWithFixedDelay is working in S1592 in other bindings.