Package io.engineblock.metrics
Class PeriodicRunnable<T extends java.lang.Runnable>
- java.lang.Object
-
- io.engineblock.metrics.PeriodicRunnable<T>
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.lang.Runnable
public class PeriodicRunnable<T extends java.lang.Runnable> extends java.lang.Object implements java.lang.Runnable, java.lang.AutoCloseableThis is a simple and light way to run a periodic task
-
-
Constructor Summary
Constructors Constructor Description PeriodicRunnable(long intervalMillis, T action)
-
Method Summary
Modifier and Type Method Description voidclose()java.lang.ThreadgetThread()voidrun()PeriodicRunnable<T>startDaemonThread()PeriodicRunnable<T>startMainThread()
-
-
-
Constructor Detail
-
PeriodicRunnable
public PeriodicRunnable(long intervalMillis, T action)
-
-
Method Detail
-
startDaemonThread
public PeriodicRunnable<T> startDaemonThread()
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
startMainThread
public PeriodicRunnable<T> startMainThread()
-
getThread
public java.lang.Thread getThread()
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
-