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.ThreadFactory
Scheduler 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 long
computeInitialDelayMillis(long currentMillis, long offsetMillis, long periodMillis)
static Scheduler
getInstance()
java.lang.Thread
newThread(java.lang.Runnable runner)
Provide a nice name for debugging and log thread creation.boolean
scheduleModuleRuns(java.util.Map<Key,java.lang.Class<? extends CollecTorMain>> collecTorMains, Configuration conf)
Schedule all classes given according to the parameters in the configuration and return whether the caller should wait for completion.void
shutdownScheduler()
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 boolean scheduleModuleRuns(java.util.Map<Key,java.lang.Class<? extends CollecTorMain>> collecTorMains, Configuration conf)
Schedule all classes given according to the parameters in the configuration and return whether the caller should wait for completion.
-
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:
newThread
in interfacejava.util.concurrent.ThreadFactory
-
-