Class Threads<T>

  • Type Parameters:
    T - The type of task result item.
    All Implemented Interfaces:
    Iterable<T>

    public final class Threads<T>
    extends IterableEnvelope<T>
    Allows to execute the tasks concurrently, optionally within given timeout.
    Since:
    1.0.0
    • Constructor Detail

      • Threads

        @SafeVarargs
        public Threads​(ExecutorService exc,
                       Scalar<? extends T>... tasks)
        Ctor.
        Parameters:
        exc - The executor.
        tasks - The tasks to be executed concurrently.
      • Threads

        public Threads​(ExecutorService exc,
                       Iterable<? extends Scalar<? extends T>> tasks)
        Ctor.
        Parameters:
        exc - The executor.
        tasks - The tasks to be executed concurrently.
      • Threads

        public Threads​(int threads,
                       Iterable<? extends Scalar<? extends T>> tasks)
        Ctor.
        Parameters:
        threads - The quantity of threads which will be used within the ExecutorService.
        tasks - The tasks to be executed concurrently.
      • Threads

        @SafeVarargs
        public Threads​(ExecutorService exc,
                       Duration timeout,
                       Scalar<? extends T>... tasks)
        Ctor.
        Parameters:
        exc - The executor.
        timeout - The maximum time to wait.
        tasks - The tasks to be executed concurrently.
      • Threads

        public Threads​(ExecutorService exc,
                       Duration timeout,
                       Iterable<? extends Scalar<? extends T>> tasks)
        Ctor.
        Parameters:
        exc - The executor.
        timeout - The maximum time to wait.
        tasks - The tasks to be executed concurrently.