Class LimitedProcessExecutor
- java.lang.Object
-
- de.hybris.platform.mediaconversion.os.process.AbstractProcessExecutor
-
- de.hybris.platform.mediaconversion.os.process.impl.LimitedProcessExecutor
-
- All Implemented Interfaces:
ProcessExecutor
public class LimitedProcessExecutor extends AbstractProcessExecutor
ProcessExecutorimplementation wrapping anotherProcessExecutorbut limiting the amount of parallel process to a given number.
-
-
Constructor Summary
Constructors Constructor Description LimitedProcessExecutor(int limit, ProcessExecutor executor)Creates a newLimitedProcessExecutordelegating all requests to the givenexecutorand limiting parallel processes to the specifiedlimit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intexecute(ProcessContext context)Delegates the execution request to the underlyingProcessExecutor, but blocking the currentThreadif the maximum number of parallel processes has already been reached.ProcessExecutorgetExecutor()Accesses the delegate.voidquit()Terminates thisProcessExecutorand frees all associated resources.-
Methods inherited from class de.hybris.platform.mediaconversion.os.process.AbstractProcessExecutor
execute
-
-
-
-
Constructor Detail
-
LimitedProcessExecutor
public LimitedProcessExecutor(int limit, ProcessExecutor executor)Creates a newLimitedProcessExecutordelegating all requests to the givenexecutorand limiting parallel processes to the specifiedlimit.- Parameters:
limit- the maximum number of parallel process to execute.executor- theProcessExecutorto delegate to.
-
-
Method Detail
-
getExecutor
public ProcessExecutor getExecutor()
Accesses the delegate.- Returns:
- the
ProcessExecutorto delegate to.
-
execute
public int execute(ProcessContext context) throws java.io.IOException
Delegates the execution request to the underlyingProcessExecutor, but blocking the currentThreadif the maximum number of parallel processes has already been reached.Synchronously executes the given
ProcessContext.- Parameters:
context- the context to execute- Returns:
- the exit code of the underlying os process.
- Throws:
java.io.IOException- on eny error while executing the process.- See Also:
ProcessExecutor.execute(ProcessContext)
-
quit
public void quit() throws java.io.IOExceptionTerminates thisProcessExecutorand frees all associated resources. Note the lifecycle of aProcessExecutorhas tenant scope, i.e. there is no need to callProcessExecutor.quit()except when shutting down the server (what will be done automatically).- Throws:
java.io.IOException- on any error- See Also:
ProcessExecutor.quit()
-
-