Class Scheduler
- java.lang.Object
-
- org.torproject.metrics.collector.cron.Scheduler
-
- All Implemented Interfaces:
java.util.concurrent.ThreadFactory
public final class Scheduler extends java.lang.Object implements java.util.concurrent.ThreadFactoryScheduler that starts the modules configured in collector.properties.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static longcomputeInitialDelayMillis(long currentMillis, long offsetMillis, long periodMillis)static SchedulergetInstance()java.lang.ThreadnewThread(java.lang.Runnable runner)Provide a nice name for debugging and log thread creation.voidscheduleModuleRuns(java.util.Map<Key,java.lang.Class<? extends CollecTorMain>> collecTorMains, Configuration conf)Schedule all classes given according to the parameters in the the configuration.voidshutdownScheduler()Try to shutdown smoothly, i.e., wait for running tasks to terminate.
-
-
-
Field Detail
-
ACTIVATED
public static final java.lang.String ACTIVATED
- See Also:
- Constant Field Values
-
PERIODMIN
public static final java.lang.String PERIODMIN
- See Also:
- Constant Field Values
-
OFFSETMIN
public static final java.lang.String OFFSETMIN
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static Scheduler getInstance()
-
scheduleModuleRuns
public void scheduleModuleRuns(java.util.Map<Key,java.lang.Class<? extends CollecTorMain>> collecTorMains, Configuration conf)
Schedule all classes given according to the parameters in the the configuration.
-
computeInitialDelayMillis
protected static long computeInitialDelayMillis(long currentMillis, long offsetMillis, long periodMillis)
-
shutdownScheduler
public void shutdownScheduler()
Try to shutdown smoothly, i.e., wait for running tasks to terminate.
-
newThread
public java.lang.Thread newThread(java.lang.Runnable runner)
Provide a nice name for debugging and log thread creation.- Specified by:
newThreadin interfacejava.util.concurrent.ThreadFactory
-
-