Package org.cactoos.experimental
Class Threads<T>
- java.lang.Object
-
- org.cactoos.iterable.IterableEnvelope<T>
-
- org.cactoos.experimental.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 Summary
Constructors Constructor Description Threads(int threads, Iterable<? extends Scalar<? extends T>> tasks)
Ctor.Threads(int threads, Duration timeout, Iterable<? extends Scalar<? extends T>> tasks)
Ctor.Threads(int threads, Duration timeout, Scalar<? extends T>... tasks)
Ctor.Threads(int threads, Scalar<? extends T>... tasks)
Ctor.Threads(ExecutorService exc, Iterable<? extends Scalar<? extends T>> tasks)
Ctor.Threads(ExecutorService exc, Duration timeout, Iterable<? extends Scalar<? extends T>> tasks)
Ctor.Threads(ExecutorService exc, Duration timeout, Scalar<? extends T>... tasks)
Ctor.Threads(ExecutorService exc, Scalar<? extends T>... tasks)
Ctor.
-
Method Summary
-
Methods inherited from class org.cactoos.iterable.IterableEnvelope
equals, hashCode, iterator, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
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
@SafeVarargs public Threads(int threads, Scalar<? extends T>... tasks)
Ctor.- Parameters:
threads
- The quantity of threads which will be used within theExecutorService
.tasks
- The tasks to be executed concurrently.- See Also:
Executors.newFixedThreadPool(int)
-
Threads
public Threads(int threads, Iterable<? extends Scalar<? extends T>> tasks)
Ctor.- Parameters:
threads
- The quantity of threads which will be used within theExecutorService
.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.
-
Threads
@SafeVarargs public Threads(int threads, Duration timeout, Scalar<? extends T>... tasks)
Ctor.- Parameters:
threads
- The quantity of threads which will be used within theExecutorService
.timeout
- The maximum time to wait.tasks
- The tasks to be executed concurrently.- See Also:
Executors.newFixedThreadPool(int)
-
Threads
public Threads(int threads, Duration timeout, Iterable<? extends Scalar<? extends T>> tasks)
Ctor.- Parameters:
threads
- The quantity of threads which will be used within theExecutorService
.timeout
- The maximum time to wait.tasks
- The tasks to be executed concurrently.- See Also:
Executors.newFixedThreadPool(int)
-
-