Package io.ebean

Interface BackgroundExecutor

  • All Known Subinterfaces:
    SpiBackgroundExecutor
    All Known Implementing Classes:
    DefaultBackgroundExecutor

    public interface BackgroundExecutor
    Background thread pool service for executing of tasks asynchronously.

    This service is used internally by Ebean for executing background tasks such as the Query.findFutureList() and also for executing background tasks periodically.

    This service has been made available so you can use it for your application code if you want. It can be useful for some server caching implementations (background population and trimming of the cache etc).

    Author:
    rbygrave
    • Method Detail

      • executePeriodically

        void executePeriodically​(Runnable r,
                                 long initialDelay,
                                 long delay,
                                 TimeUnit unit)
        Execute a task periodically additionally with an initial delay different from delay.
      • schedule

        ScheduledFuture<?> schedule​(Runnable r,
                                    long delay,
                                    TimeUnit unit)
        Schedules a Runnable for one-shot action that becomes enabled after the given delay.
        Returns:
        a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion
      • schedule

        <V> ScheduledFuture<V> schedule​(Callable<V> c,
                                        long delay,
                                        TimeUnit unit)
        Schedules a Callable for one-shot action that becomes enabled after the given delay.
        Returns:
        a ScheduledFuture that can be used to extract result or cancel