Package de.cxp.ocs.util
Class OnceInAWhileRunner
- java.lang.Object
-
- de.cxp.ocs.util.OnceInAWhileRunner
-
-
Constructor Summary
Constructors Constructor Description OnceInAWhileRunner()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidrunAgainAfter(Runnable runnable, String key, ChronoUnit unit, long expires)Runs theRunnablewith the same key only once in a specified time frame.
-
-
-
Method Detail
-
runAgainAfter
public static void runAgainAfter(Runnable runnable, String key, ChronoUnit unit, long expires)
Runs theRunnablewith the same key only once in a specified time frame.- Parameters:
runnable- the runnable to run.key- the key which should be unique for the same runnable.unit- theChronoUnitwhich describes the time frame. Please refer toInstant.plus(java.time.temporal.TemporalAmount)for a list of supported units.expires- the frame span for the specified unit.
-
-