Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Scheduler Question

The org.eclipse.jetty.util.thread.Scheduler is an interface from back in the Java versions that didn't have a scheduler of its own (we're talking back in the Java 1.4 days!).
Anymore, the implementation in Jetty is just a `java.util.concurrent.ScheduledExecutorService` under the covers.

You would probably be better off just using the JVM class directly, and not be subject to the side effects of how Jetty uses its own scheduler. (example: the idle timeout behaviors and low resource behaviors can cancel tasks, or reduce the timing, or even increase the timing, depending on where the scheduler is)
https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/concurrent/ScheduledExecutorService.html

 - Joakim

On Wed, Aug 14, 2024 at 1:30 PM Josh Spiegel via jetty-users <jetty-users@xxxxxxxxxxx> wrote:
Hi,

We are using the scheduler to schedule a background task that runs every 2 seconds:

    connector.getScheduler().schedule(this, 2000, TimeUnit.MILLISECONDS);

When it wakes up, it processes some log data and then schedules itself to run again in 2 seconds.

Very rarely, for a cause and reason we can't explain, the rescheduling does not happen and the background process never runs again.  We've caught any possible Throwable in the task execution and log any possible exception that might occur.  The logs are empty, the task just stops.  The thread pool is nowhere near exhausted when this happens.

This happens so rarely that it is very difficult to debug. 

Any ideas what might cause something like this?

Thanks,
Josh
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top