Class SingletonTimerFactory
java.lang.Object
org.apache.derby.impl.services.timer.SingletonTimerFactory
- All Implemented Interfaces:
ModuleControl, TimerFactory
This class implements the TimerFactory interface.
It creates a singleton Timer instance.
The class implements the ModuleControl interface,
because it needs to cancel the Timer at system shutdown.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicIntegerThe number of timescancel(TimerTask)has been called.private final TimerSingleton Timer instance.private StringBuilderInitialization warnings. -
Constructor Summary
ConstructorsConstructorDescriptionInitializes this TimerFactory with a singleton Timer instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidboot(boolean create, Properties properties) Currently does nothing, singleton Timer instance is initialized in the constructor.voidCancel a task.private ClassLoaderCheck if the current context class loader could cause a memory leak (DERBY-3745) if it is inherited by the timer thread, and return it if that is the case.Return any warnings generated during the initialization of this class, or null if noneprivate voidreport(SecurityException se, String id) voidSchedule a task.private voidvoidstop()Cancels the singleton Timer instance.
-
Field Details
-
singletonTimer
Singleton Timer instance. -
cancelCount
The number of timescancel(TimerTask)has been called. Used for determining whether it's time to purge cancelled tasks from the timer. -
warnings
Initialization warnings. SeegetWarnings().
-
-
Constructor Details
-
SingletonTimerFactory
public SingletonTimerFactory()Initializes this TimerFactory with a singleton Timer instance.
-
-
Method Details
-
schedule
Description copied from interface:TimerFactorySchedule a task.- Specified by:
schedulein interfaceTimerFactory- Parameters:
task- the task to scheduledelay- how many milliseconds to wait before executing the task
-
cancel
Description copied from interface:TimerFactoryCancel a task.- Specified by:
cancelin interfaceTimerFactory- Parameters:
task- the task to cancel
-
boot
Currently does nothing, singleton Timer instance is initialized in the constructor. Implements the ModuleControl interface.- Specified by:
bootin interfaceModuleControl- Parameters:
create- not usedproperties- not used- Throws:
StandardException- not used- See Also:
-
stop
public void stop()Cancels the singleton Timer instance. Implements the ModuleControl interface.- Specified by:
stopin interfaceModuleControl- See Also:
-
getContextClassLoader
Check if the current context class loader could cause a memory leak (DERBY-3745) if it is inherited by the timer thread, and return it if that is the case.- Returns:
- the context class loader of the current thread if it is
not the same class loader as the one used by the system classes
or the Derby classes and we have permission to read the class
loaders, or
nullotherwise
-
setContextClassLoader
-
report
-
getWarnings
Return any warnings generated during the initialization of this class, or null if none- Returns:
- See legend
-