[英]Simple Java timer library
我需要Java中的定时器代码具有以下功能:
Runnable
或类似代码)在特定延迟后执行一次(具有第二精度) java.util.Timer
) 我已经研究过使用Quartz,但它似乎太大了。
是否有一个小型图书馆这样做? 或者我可以实际使用Quartz吗? 或者我如何使用ScheduledExecutor
自己实现它?
我没有完全问这个问题,但你似乎只想要Java定时器没有给出的是线程池,虽然我从来没有使用我得到的答案他们似乎解决了这个问题
看看这篇文章: 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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.