Class 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 einer CronDefinition 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 Thread
      CronScheduler​(int corePoolSize)
      Erstellt einen CronScheduler
      CronScheduler​(int corePoolSize, java.util.concurrent.ThreadFactory threadFactory)
      Erstellt einen CronScheduler
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.concurrent.ExecutorService

        awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated
    • 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 Threads
        threadFactory - ThreadFactory
    • Method Detail

      • schedule

        public java.util.concurrent.ScheduledFuture<?> schedule​(java.lang.Runnable command,
                                                                CronDefinition cronDefinition)
        Plant einen Auftrag
        Parameters:
        command - Auszuführender Befehl
        cronDefinition - 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 Befehl
        cronDefinition - 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 class java.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()