public class LimitedProcessExecutor extends AbstractProcessExecutor
ProcessExecutor implementation wrapping another ProcessExecutor but limiting the amount of parallel
process to a given number.| Constructor and Description |
|---|
LimitedProcessExecutor(int limit,
ProcessExecutor executor)
Creates a new
LimitedProcessExecutor delegating all requests to the given executor and
limiting parallel processes to the specified limit. |
| Modifier and Type | Method and Description |
|---|---|
int |
execute(ProcessContext context)
Delegates the execution request to the underlying
ProcessExecutor, but blocking the current Thread
if the maximum number of parallel processes has already been reached. |
ProcessExecutor |
getExecutor()
Accesses the delegate.
|
void |
quit()
Terminates this
ProcessExecutor and frees all associated resources. |
executepublic LimitedProcessExecutor(int limit,
ProcessExecutor executor)
LimitedProcessExecutor delegating all requests to the given executor and
limiting parallel processes to the specified limit.limit - the maximum number of parallel process to execute.executor - the ProcessExecutor to delegate to.public ProcessExecutor getExecutor()
ProcessExecutor to delegate to.public int execute(ProcessContext context) throws java.io.IOException
ProcessExecutor, but blocking the current Thread
if the maximum number of parallel processes has already been reached.
Synchronously executes the given ProcessContext.context - the context to executejava.io.IOException - on eny error while executing the process.ProcessExecutor.execute(ProcessContext)public void quit()
throws java.io.IOException
ProcessExecutor and frees all associated resources.
Note the lifecycle of a ProcessExecutor has tenant scope, i.e. there is no need to call ProcessExecutor.quit()
except when shutting down the server (what will be done automatically).java.io.IOException - on any errorProcessExecutor.quit()Copyright © 2018 SAP SE. All Rights Reserved.