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 TypeMethodDescriptionvoid
Specifies 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> T
getInstance
(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.boolean
isAlive()
Returns whether the process is currently running.void
kill()
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:IProcessWrapper
Returns a key associated with the process.
- Specified by:
getKey
in interfaceIProcessWrapper
- Returns:
- a key associated with the process (not
null
)
-
getProcessBinder
Description copied from interface:IProcessWrapper
Returns the process binder.
- Specified by:
getProcessBinder
in 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:IProcessWrapper
Returns a proxy to given service running within the process.
- Specified by:
getInstance
in 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:IProcessWrapper
Returns the output stream piped to the process's standard input stream. The specification is the same as for
IProcessManager.getOutputStream(String)
.- Specified by:
getOutputStream
in interfaceIProcessWrapper
- Returns:
- the output stream piped to the process's standard input stream (see
IProcessManager.getOutputStream(String)
) - See Also:
-
getInputStream
Description copied from interface:IProcessWrapper
Returns the input stream piped to the process's standard output stream. The specification is the same as for
IProcessManager.getInputStream(String)
.- Specified by:
getInputStream
in interfaceIProcessWrapper
- Returns:
- the input stream piped to the process's standard output stream (see
IProcessManager.getInputStream(String)
) - See Also:
-
getErrorsStream
Description copied from interface:IProcessWrapper
Returns the input stream piped to the process's standard errors stream. The specification is the same as for
IProcessManager.getErrorsStream(String)
.- Specified by:
getErrorsStream
in interfaceIProcessWrapper
- Returns:
- the input stream piped to the process's standard errors stream (see
IProcessManager.getErrorsStream(String)
) - See Also:
-
dispose
Description copied from interface:IProcessWrapper
Specifies 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:
dispose
in interfaceIProcessWrapper
-
isAlive
public boolean isAlive()Description copied from interface:IProcessWrapper
Returns whether the process is currently running.
- Specified by:
isAlive
in interfaceIProcessWrapper
- Returns:
- whether the process is currently running (
true
offalse
)
-
kill
public void kill()Description copied from interface:IProcessWrapper
Kills the process.
- Specified by:
kill
in interfaceIProcessWrapper
-