I have need for timer code in Java with these features:
Runnable
or something like it) to execute once after a specific delay (with second precision) java.util.Timer
) I've looked into using Quartz, but it appears to be simply too large.
Is there a smallish library that does this? Or can I actually use Quartz? Or how would I implement it myself, using ScheduledExecutor
?
I didn't quite ask this question but the only thing you seem to want that Java timers aren't giving is thread pooling, and while I never got around to using the answers I got they seem to address that
Look at this post : Java Timer vs ExecutorService?
public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit); public ScheduledFuture<V> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit); public ScheduledFuture<V> scheduleWithFixedDelay( Runnable command, long initialDelay, long delay, TimeUnit unit);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.