Interface ExecutorPlus

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void execute​(WithResources withResources, java.lang.Runnable task)
      Invoke task.
      boolean inExecutor()  
      default <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)  
      default <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit)  
      default <T> T invokeAny​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)  
      default <T> T invokeAny​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit)  
      default void maybeExecuteImmediately​(java.lang.Runnable task)
      MAY execute task immediately, if the calling thread is permitted to do so.
      Future<?> submit​(java.lang.Runnable task)
      Overrides ExecutorService.submit(Runnable) to return a Cassandra Future
      <T> Future<T> submit​(java.lang.Runnable task, T result)
      Overrides ExecutorService.submit(Runnable, Object) to return a Cassandra Future
      <T> Future<T> submit​(java.util.concurrent.Callable<T> task)
      Overrides ExecutorService.submit(Callable) to return a Cassandra Future
      Future<?> submit​(WithResources withResources, java.lang.Runnable task)
      Invoke task, returning a future yielding null if successful, or the abnormal termination of task otherwise.
      <T> Future<T> submit​(WithResources withResources, java.lang.Runnable task, T result)
      Invoke task, returning a future yielding result if successful, or the abnormal termination of task otherwise.
      <T> Future<T> submit​(WithResources withResources, java.util.concurrent.Callable<T> task)
      Invoke task, returning a future representing this computation.
      • Methods inherited from interface java.util.concurrent.Executor

        execute
      • Methods inherited from interface java.util.concurrent.ExecutorService

        awaitTermination, isShutdown, isTerminated, shutdown, shutdownNow
    • Method Detail

      • maybeExecuteImmediately

        default void maybeExecuteImmediately​(java.lang.Runnable task)
        MAY execute task immediately, if the calling thread is permitted to do so.
      • submit

        <T> Future<T> submit​(java.util.concurrent.Callable<T> task)
        Overrides ExecutorService.submit(Callable) to return a Cassandra Future
        Specified by:
        submit in interface java.util.concurrent.ExecutorService
      • submit

        <T> Future<T> submit​(java.lang.Runnable task,
                             T result)
        Overrides ExecutorService.submit(Runnable, Object) to return a Cassandra Future
        Specified by:
        submit in interface java.util.concurrent.ExecutorService
      • submit

        Future<?> submit​(java.lang.Runnable task)
        Overrides ExecutorService.submit(Runnable) to return a Cassandra Future
        Specified by:
        submit in interface java.util.concurrent.ExecutorService
      • execute

        void execute​(WithResources withResources,
                     java.lang.Runnable task)
        Invoke task. The invoking thread will first instantiate the resources provided before invoking task, so that thread state may be modified and cleaned up. The invoking thread will execute something semantically equivlent to: try (Closeable close = withResources.get()) { task.run(); }
        Parameters:
        withResources - the resources to create and hold while executing task
        task - the task to execute
      • submit

        <T> Future<T> submit​(WithResources withResources,
                             java.util.concurrent.Callable<T> task)
        Invoke task, returning a future representing this computation. The invoking thread will first instantiate the resources provided before invoking task, so that thread state may be modified and cleaned up. The invoking thread will execute something semantically equivlent to: try (Closeable close = withResources.get()) { return task.call(); }
        Parameters:
        withResources - the resources to create and hold while executing task
        task - the task to execute
      • submit

        Future<?> submit​(WithResources withResources,
                         java.lang.Runnable task)
        Invoke task, returning a future yielding null if successful, or the abnormal termination of task otherwise. The invoking thread will first instantiate the resources provided before invoking task, so that thread state may be modified and cleaned up try (Closeable close = withResources.get()) { task.run(); return null; }
        Parameters:
        withResources - the resources to create and hold while executing task
        task - the task to execute
      • submit

        <T> Future<T> submit​(WithResources withResources,
                             java.lang.Runnable task,
                             T result)
        Invoke task, returning a future yielding result if successful, or the abnormal termination of task otherwise. The invoking thread will first instantiate the resources provided before invoking task, so that thread state may be modified and cleaned up. The invoking thread will execute something semantically equivlent to: try (Closeable close = withResources.get()) { task.run(); return result; }
        Parameters:
        withResources - the resources to create and hold while executing task
        task - the task to execute
        result - the result if successful
      • inExecutor

        boolean inExecutor()
        Returns:
        true iff the caller is a worker thread actively serving this executor
      • invokeAll

        default <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
                                                                      throws java.lang.InterruptedException
        Specified by:
        invokeAll in interface java.util.concurrent.ExecutorService
        Throws:
        java.lang.InterruptedException
      • invokeAll

        default <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
                                                                             long timeout,
                                                                             java.util.concurrent.TimeUnit unit)
                                                                      throws java.lang.InterruptedException
        Specified by:
        invokeAll in interface java.util.concurrent.ExecutorService
        Throws:
        java.lang.InterruptedException
      • invokeAny

        default <T> T invokeAny​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
                         throws java.lang.InterruptedException,
                                java.util.concurrent.ExecutionException
        Specified by:
        invokeAny in interface java.util.concurrent.ExecutorService
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
      • invokeAny

        default <T> T invokeAny​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
                                long timeout,
                                java.util.concurrent.TimeUnit unit)
                         throws java.lang.InterruptedException,
                                java.util.concurrent.ExecutionException,
                                java.util.concurrent.TimeoutException
        Specified by:
        invokeAny in interface java.util.concurrent.ExecutorService
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException