Class SameThreadScheduledExecutorService

    • Constructor Detail

      • SameThreadScheduledExecutorService

        SameThreadScheduledExecutorService()
    • Method Detail

      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface java.util.concurrent.ExecutorService
      • shutdownNow

        public java.util.List<java.lang.Runnable> shutdownNow()
        Specified by:
        shutdownNow in interface java.util.concurrent.ExecutorService
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface java.util.concurrent.ExecutorService
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface java.util.concurrent.ExecutorService
      • awaitTermination

        public boolean awaitTermination​(long timeout,
                                        java.util.concurrent.TimeUnit unit)
                                 throws java.lang.InterruptedException
        Specified by:
        awaitTermination in interface java.util.concurrent.ExecutorService
        Throws:
        java.lang.InterruptedException
      • submit

        public <T> ListenableFuture<T> submit​(java.util.concurrent.Callable<T> task)
        Specified by:
        submit in interface java.util.concurrent.ExecutorService
        Specified by:
        submit in interface ListeningExecutorService
        Overrides:
        submit in class java.util.concurrent.AbstractExecutorService
        Returns:
        a ListenableFuture representing pending completion of the task
      • submit

        public <T> ListenableFuture<T> submit​(java.lang.Runnable task,
                                              T result)
        Specified by:
        submit in interface java.util.concurrent.ExecutorService
        Specified by:
        submit in interface ListeningExecutorService
        Overrides:
        submit in class java.util.concurrent.AbstractExecutorService
        Returns:
        a ListenableFuture representing pending completion of the task
      • submit

        public ListenableFuture<?> submit​(java.lang.Runnable task)
        Specified by:
        submit in interface java.util.concurrent.ExecutorService
        Specified by:
        submit in interface ListeningExecutorService
        Overrides:
        submit in class java.util.concurrent.AbstractExecutorService
        Returns:
        a ListenableFuture representing pending completion of the task
      • invokeAll

        public <T> java.util.List<java.util.concurrent.Future<T>> invokeAll​(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
                                                                     throws java.lang.InterruptedException
        Description copied from interface: ListeningExecutorService

        All elements in the returned list must be ListenableFuture instances. The easiest way to obtain a List<ListenableFuture<T>> from this method is an unchecked (but safe) cast:

           @SuppressWarnings("unchecked") // guaranteed by invokeAll contract
           List<ListenableFuture<T>> futures = (List) executor.invokeAll(tasks);
         
        Specified by:
        invokeAll in interface java.util.concurrent.ExecutorService
        Specified by:
        invokeAll in interface ListeningExecutorService
        Overrides:
        invokeAll in class java.util.concurrent.AbstractExecutorService
        Returns:
        A list of ListenableFuture instances representing the tasks, in the same sequential order as produced by the iterator for the given task list, each of which has completed.
        Throws:
        java.lang.InterruptedException
      • invokeAll

        public <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
        Description copied from interface: ListeningExecutorService

        All elements in the returned list must be ListenableFuture instances. The easiest way to obtain a List<ListenableFuture<T>> from this method is an unchecked (but safe) cast:

           @SuppressWarnings("unchecked") // guaranteed by invokeAll contract
           List<ListenableFuture<T>> futures = (List) executor.invokeAll(tasks, timeout, unit);
         
        Specified by:
        invokeAll in interface java.util.concurrent.ExecutorService
        Specified by:
        invokeAll in interface ListeningExecutorService
        Overrides:
        invokeAll in class java.util.concurrent.AbstractExecutorService
        Returns:
        a list of ListenableFuture instances representing the tasks, in the same sequential order as produced by the iterator for the given task list. If the operation did not time out, each task will have completed. If it did time out, some of these tasks will not have completed.
        Throws:
        java.lang.InterruptedException
      • invokeAny

        public <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
        Overrides:
        invokeAny in class java.util.concurrent.AbstractExecutorService
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
      • invokeAny

        public <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
        Overrides:
        invokeAny in class java.util.concurrent.AbstractExecutorService
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • execute

        public void execute​(java.lang.Runnable command)
        Specified by:
        execute in interface java.util.concurrent.Executor