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:
java.util.concurrent.Executor
,java.util.concurrent.ExecutorService
,java.util.concurrent.ScheduledExecutorService
public class CronScheduler extends java.util.concurrent.ScheduledThreadPoolExecutor
ScheduledExecutorService-Implementierung, die anhand einerCronDefinition
periodische Aufträge planen kann
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
-
-
Constructor Summary
Constructors Constructor Description CronScheduler()
Erstellt einen CronScheduler mit einem ThreadCronScheduler(int corePoolSize)
Erstellt einen CronSchedulerCronScheduler(int corePoolSize, java.util.concurrent.ThreadFactory threadFactory)
Erstellt einen CronScheduler
-
Method Summary
Modifier and Type Method Description protected <V> java.util.concurrent.RunnableScheduledFuture<V>
decorateTask(java.lang.Runnable runnable, java.util.concurrent.RunnableScheduledFuture<V> task)
protected long
getTime()
Zum testen überschreibbar um eine andere Uhr zu benutzen.java.util.concurrent.ScheduledFuture<?>
schedule(java.lang.Runnable command, CronDefinition cronDefinition)
Plant einen Auftrag<V> java.util.concurrent.ScheduledFuture<V>
schedule(java.util.concurrent.Callable<V> callable, CronDefinition cronDefinition)
Plant einen Auftrag-
Methods inherited from class java.util.concurrent.ScheduledThreadPoolExecutor
decorateTask, execute, getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, getRemoveOnCancelPolicy, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setRemoveOnCancelPolicy, shutdown, shutdownNow, submit, submit, submit
-
Methods 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, toString
-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor
-
-
-
-
Constructor Detail
-
CronScheduler
public CronScheduler()
Erstellt einen CronScheduler mit einem Thread
-
CronScheduler
public CronScheduler(int corePoolSize)
Erstellt einen CronScheduler- Parameters:
corePoolSize
- Anzahl Threads
-
CronScheduler
public CronScheduler(int corePoolSize, java.util.concurrent.ThreadFactory threadFactory)
Erstellt einen CronScheduler- Parameters:
corePoolSize
- Anzahl ThreadsthreadFactory
- ThreadFactory
-
-
Method Detail
-
schedule
public java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable command, CronDefinition cronDefinition)
Plant einen Auftrag- Parameters:
command
- Auszuführender BefehlcronDefinition
- Auszuführende Zeitpunkte- Returns:
- ScheduledFuture-Objekt zum Abfragen des Ergebnisses (sofern vorhanden)
-
schedule
public <V> java.util.concurrent.ScheduledFuture<V> schedule(java.util.concurrent.Callable<V> callable, CronDefinition cronDefinition)
Plant einen Auftrag- Parameters:
callable
- Auszuführender BefehlcronDefinition
- Auszuführende Zeitpunkte- Returns:
- ScheduledFuture-Objekt zum Abfragen des Ergebnisses (sofern vorhanden)
-
decorateTask
protected <V> java.util.concurrent.RunnableScheduledFuture<V> decorateTask(java.lang.Runnable runnable, java.util.concurrent.RunnableScheduledFuture<V> task)
- Overrides:
decorateTask
in classjava.util.concurrent.ScheduledThreadPoolExecutor
-
getTime
protected long getTime()
Zum testen überschreibbar um eine andere Uhr zu benutzen.- Returns:
- aktuelle Zeit in Millisekunden analog zu System.currentTimeMillis()
-
-