public static class WorkerProcessPoolSync.BorrowedWorkerProcess extends Object implements Closeable
WorkerProcess
borrowed from a WorkerProcessPoolSync
.
Ownership must be returned to the pool by calling close()
after finishing to use
the worker.
Since BorrowedWorkerProcess implements Closable, it can be used with a try-with-resources statement.
BorrowedWorkerProcess is not threadsafe, and is expected to be used by one thread at a time
only. Concurrency control is handled by WorkerProcessPoolSync
and WorkerLifecycle
.
Modifier and Type | Method and Description |
---|---|
void |
close()
Returns ownership of the borrowed worker process back to the pool it was retrieved from.
|
com.google.common.util.concurrent.ListenableFuture<WorkerJobResult> |
submitJob(String expandedJobArgs)
Submits a job to the worker, and returns the result.
|
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public com.google.common.util.concurrent.ListenableFuture<WorkerJobResult> submitJob(String expandedJobArgs) throws IOException
IOException