Package de.bsvrz.dav.daf.util.cron
Class CronScheduler
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
java.util.concurrent.ScheduledThreadPoolExecutor
de.bsvrz.dav.daf.util.cron.CronScheduler
- All Implemented Interfaces:
Executor,ExecutorService,ScheduledExecutorService
ScheduledExecutorService-Implementierung, die anhand einer
CronDefinition periodische Aufträge planen kann-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy -
Constructor Summary
ConstructorsConstructorDescriptionErstellt einen CronScheduler mit einem ThreadCronScheduler(int corePoolSize) Erstellt einen CronSchedulerCronScheduler(int corePoolSize, ThreadFactory threadFactory) Erstellt einen CronScheduler -
Method Summary
Modifier and TypeMethodDescriptionprotected <V> RunnableScheduledFuture<V>decorateTask(Runnable runnable, RunnableScheduledFuture<V> task) protected longgetTime()Zum testen überschreibbar um eine andere Uhr zu benutzen.schedule(Runnable command, CronDefinition cronDefinition) Plant einen Auftrag<V> ScheduledFuture<V>schedule(Callable<V> callable, CronDefinition cronDefinition) Plant einen AuftragMethods inherited from class java.util.concurrent.ScheduledThreadPoolExecutor
decorateTask, execute, getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, getRemoveOnCancelPolicy, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setRemoveOnCancelPolicy, shutdown, shutdownNow, submit, submit, submitMethods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, terminated, toStringMethods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskForMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated
-
Constructor Details
-
CronScheduler
public CronScheduler()Erstellt einen CronScheduler mit einem Thread -
CronScheduler
public CronScheduler(int corePoolSize) Erstellt einen CronScheduler- Parameters:
corePoolSize- Anzahl Threads
-
CronScheduler
Erstellt einen CronScheduler- Parameters:
corePoolSize- Anzahl ThreadsthreadFactory- ThreadFactory
-
-
Method Details
-
schedule
Plant einen Auftrag- Parameters:
command- Auszuführender BefehlcronDefinition- Auszuführende Zeitpunkte- Returns:
- ScheduledFuture-Objekt zum Abfragen des Ergebnisses (sofern vorhanden)
-
schedule
Plant einen Auftrag- Parameters:
callable- Auszuführender BefehlcronDefinition- Auszuführende Zeitpunkte- Returns:
- ScheduledFuture-Objekt zum Abfragen des Ergebnisses (sofern vorhanden)
-
decorateTask
protected <V> RunnableScheduledFuture<V> decorateTask(Runnable runnable, RunnableScheduledFuture<V> task) - Overrides:
decorateTaskin classScheduledThreadPoolExecutor
-
getTime
protected long getTime()Zum testen überschreibbar um eine andere Uhr zu benutzen.- Returns:
- aktuelle Zeit in Millisekunden analog zu System.currentTimeMillis()
-