Package ai.preferred.venom
Class ThreadedWorkerManager
- java.lang.Object
-
- ai.preferred.venom.ThreadedWorkerManager
-
- All Implemented Interfaces:
Interruptible,WorkerManager,java.lang.AutoCloseable
public class ThreadedWorkerManager extends java.lang.Object implements WorkerManager
- Author:
- Maksim Tkachenko
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classThreadedWorkerManager.AbstractManagedBlockingWorkerThis abstract class exposes the methods to allow submitting tasks for multithreading and implements inline blocking method.
-
Constructor Summary
Constructors Constructor Description ThreadedWorkerManager()Constructs a threaded worker manager with a specified executor.ThreadedWorkerManager(java.util.concurrent.ExecutorService executor)Constructs a threaded worker manager with a specified executor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()WorkergetWorker()Get the result collector in use.voidinterrupt()Interrupt the underlying mechanisms of the class.
-
-
-
Constructor Detail
-
ThreadedWorkerManager
public ThreadedWorkerManager()
Constructs a threaded worker manager with a specified executor.
-
ThreadedWorkerManager
public ThreadedWorkerManager(@Nullable java.util.concurrent.ExecutorService executor)Constructs a threaded worker manager with a specified executor.- Parameters:
executor- An executor service
-
-
Method Detail
-
getWorker
public final Worker getWorker()
Description copied from interface:WorkerManagerGet the result collector in use.- Specified by:
getWorkerin interfaceWorkerManager- Returns:
- an instance of Worker
-
interrupt
public final void interrupt()
Description copied from interface:InterruptibleInterrupt the underlying mechanisms of the class.Please note that this
interruptmethod should be idempotent. In other words, calling thisinterruptmethod more than once should not have any side effect.- Specified by:
interruptin interfaceInterruptible
-
close
public final void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
-