Class ProcessWrapperImpl
- All Implemented Interfaces:
IProcessWrapper
IProcessWrapper.-
Constructor Summary
ConstructorsConstructorDescriptionProcessWrapperImpl(IProcessLauncher processLauncher, ProcessBinder processBinder) Constructs new instance with given process launcher and process binder. -
Method Summary
Modifier and TypeMethodDescriptionvoidSpecifies that given instance is no longer used.Returns the input stream piped to the process's standard errors stream.Returns the input stream piped to the process's standard output stream.<T> TgetInstance(Class<T> service) Returns a proxy to given service running within the process.getKey()Returns a key associated with the process.Returns the output stream piped to the process's standard input stream.Returns the process binder.booleanisAlive()Returns whether the process is currently running.voidkill()Kills the process.
-
Constructor Details
-
ProcessWrapperImpl
Constructs new instance with given process launcher and process binder.- Parameters:
processLauncher- givenIProcessLauncher(notnull)processBinder- givenProcessBinder(notnull)
-
-
Method Details
-
getKey
Description copied from interface:IProcessWrapperReturns a key associated with the process.
- Specified by:
getKeyin interfaceIProcessWrapper- Returns:
- a key associated with the process (not
null)
-
getProcessBinder
Description copied from interface:IProcessWrapperReturns the process binder.
- Specified by:
getProcessBinderin interfaceIProcessWrapper- Returns:
- the process binder (not
null)
-
getInstance
public <T> T getInstance(Class<T> service) throws InstantiationException, IllegalAccessException, IOException, InterruptedException, ProcessStartingTimedOut, ProcessExitedWithErrorException Description copied from interface:IProcessWrapperReturns a proxy to given service running within the process.
- Specified by:
getInstancein interfaceIProcessWrapper- Parameters:
service- given service (notnull)- Returns:
- a proxy to service running within the process (not
null) - Throws:
InstantiationException- if the implementation represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reasonIllegalAccessException- if could not instantiate the implementation by it's default constructor (for instance, if the default constructor is unaccessible)IOException- if request of starting a new process is failed due to I/O exceptionInterruptedException- if request of starting a new process is interruptedProcessStartingTimedOut- if process has not already started, and now start operation timed outProcessExitedWithErrorException- if process has not already started, and just after it started, it has exited with error code
-
getOutputStream
Description copied from interface:IProcessWrapperReturns the output stream piped to the process's standard input stream. The specification is the same as for
IProcessManager.getOutputStream(String).- Specified by:
getOutputStreamin interfaceIProcessWrapper- Returns:
- the output stream piped to the process's standard input stream (see
IProcessManager.getOutputStream(String)) - See Also:
-
getInputStream
Description copied from interface:IProcessWrapperReturns the input stream piped to the process's standard output stream. The specification is the same as for
IProcessManager.getInputStream(String).- Specified by:
getInputStreamin interfaceIProcessWrapper- Returns:
- the input stream piped to the process's standard output stream (see
IProcessManager.getInputStream(String)) - See Also:
-
getErrorsStream
Description copied from interface:IProcessWrapperReturns the input stream piped to the process's standard errors stream. The specification is the same as for
IProcessManager.getErrorsStream(String).- Specified by:
getErrorsStreamin interfaceIProcessWrapper- Returns:
- the input stream piped to the process's standard errors stream (see
IProcessManager.getErrorsStream(String)) - See Also:
-
dispose
Description copied from interface:IProcessWrapperSpecifies that given instance is no longer used. If there are no used instances in the process within some period of time, the process is killed.
- Specified by:
disposein interfaceIProcessWrapper
-
isAlive
public boolean isAlive()Description copied from interface:IProcessWrapperReturns whether the process is currently running.
- Specified by:
isAlivein interfaceIProcessWrapper- Returns:
- whether the process is currently running (
trueoffalse)
-
kill
public void kill()Description copied from interface:IProcessWrapperKills the process.
- Specified by:
killin interfaceIProcessWrapper
-