Package com._1c.g5.v8.dt.internal.pm
Class ProcessManager
java.lang.Object
com._1c.g5.v8.dt.internal.pm.ProcessManager
- All Implemented Interfaces:
IProcessManager
An IProcessManager
interface basic implementation
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
IProcessManager.dispose()
method implementation.void
IProcessManager.dispose(String)
method implementation.void
IProcessManager.dispose(String, Object)
method implementation.<T> ICloseableInstance<T>
getCloseableInstance
(String key, Class<T> service) IProcessManager.getCloseableInstance(String, Class)
method implementation.getErrorsStream
(String key) IProcessManager.getErrorsStream(String)
method implementation.getInputStream
(String key) IProcessManager.getInputStream(String)
method implementation.<T> T
getInstance
(String key, Class<T> service) A basic implementation of theIProcessManager
interface'sgetInstance(String, Class)
methodgetOutputStream
(String key) IProcessManager.getOutputStream(String)
method implementation.getProcessBinder
(String key) Returns new or exiting instance ofProcessBinder
which allows bindings for the process with given key.static ProcessManager
Returns an instance ofIProcessManager
.boolean
isProcessAlive
(String key) IProcessManager#isBound(String, Class)
method implementation.
-
Method Details
-
getProcessManager
Returns an instance of
IProcessManager
.- Throws:
RemoteException
- if startup RMI registering failsAlreadyBoundException
- if IProcessRegister is already bound (for instance, if other instance ofIProcessManager
is created and it has chosen the same port).PortAllocatingException
- when cannot obtain free port to make RMI registry listen on
-
isProcessAlive
IProcessManager#isBound(String, Class)
method implementation.- Specified by:
isProcessAlive
in interfaceIProcessManager
- Parameters:
key
- given key- Returns:
true
if the process with given key is currently runningfalse
otherwise.
-
getProcessBinder
Description copied from interface:IProcessManager
Returns new or exiting instance of
ProcessBinder
which allows bindings for the process with given key. Each calling for the same key will return the same instance.- Specified by:
getProcessBinder
in interfaceIProcessManager
- Parameters:
key
- given key- Returns:
- new or exiting instance of
ProcessBinder
which allows bindings for the process with given key - See Also:
-
getInstance
public <T> T getInstance(String key, Class<T> service) throws InstantiationException, IllegalAccessException, IOException, InterruptedException, ProcessStartingTimedOut, ProcessExitedWithErrorException A basic implementation of the
IProcessManager
interface'sgetInstance(String, Class)
method- Specified by:
getInstance
in interfaceIProcessManager
- Type Parameters:
T
- - the type of the service- Parameters:
key
- - the key of the process within that to run the implementation (notnull
)service
- - the service for that to return a stub (notnull
)- Returns:
- a stub for given service binded to implementation instance running within a separate 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 or creating an instance within a process is failedInterruptedException
- if request of starting a new process is interruptedProcessStartingTimedOut
- if could not initially start the process, or process does not responseProcessExitedWithErrorException
- if process has not already started, and just after it started, it has exited with error code
-
getCloseableInstance
public <T> ICloseableInstance<T> getCloseableInstance(String key, Class<T> service) throws IllegalAccessException, InstantiationException, IOException, InterruptedException, ProcessStartingTimedOut, ProcessExitedWithErrorException, IllegalStateException IProcessManager.getCloseableInstance(String, Class)
method implementation.- Specified by:
getCloseableInstance
in interfaceIProcessManager
- Parameters:
key
- a key of a process within that service implementation is runningservice
- a service for that instance is created- Returns:
ICloseableInstance
with wrapped instance created byIProcessManager.getInstance(String, Class)
method andICloseableInstance.close()
which invokesdispose(key, instance)
- Throws:
IllegalAccessException
- if could not instantiate the implementation by it's default constructor (for instance, if the default constructor is unaccessible)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 reasonIOException
- if request of starting a new process or creating an instance within a process is failedInterruptedException
- if request of starting a new process is interruptedProcessStartingTimedOut
- if could not initially start the process, or process does not responseProcessExitedWithErrorException
- if process has not already started, and just after it started, it has exited with error codeIllegalStateException
- if 'java.security.policy' system property is not set (System.getProperty("java.security.policy")
returns null), or service for key is not bound.- See Also:
-
getOutputStream
IProcessManager.getOutputStream(String)
method implementation.- Specified by:
getOutputStream
in interfaceIProcessManager
- Parameters:
key
- given process's key (notnull
)- Returns:
- an output stream piped to the process's standard input stream,
or null output stream if process's input stream is redirected,
or
null
if process with given key has never been running - See Also:
-
getInputStream
IProcessManager.getInputStream(String)
method implementation.- Specified by:
getInputStream
in interfaceIProcessManager
- Parameters:
key
- given process's key (notnull
)- Returns:
- an input stream piped to the process's standard output stream,
or null input stream if porcess's output stream is redirected,
or
null
if process has never been running - See Also:
-
getErrorsStream
IProcessManager.getErrorsStream(String)
method implementation.- Specified by:
getErrorsStream
in interfaceIProcessManager
- Parameters:
key
- given process's key (notnull
)- Returns:
- an input stream piped to the process's standard error stream,
or null input stream if porcess's error stream is redirected,
or
null
if process has never been running - See Also:
-
dispose
public void dispose()IProcessManager.dispose()
method implementation.- Specified by:
dispose
in interfaceIProcessManager
-
dispose
IProcessManager.dispose(String)
method implementation.- Specified by:
dispose
in interfaceIProcessManager
- Parameters:
key
- - the key for that to release resources. This key is also associated with the process to kill. (notnull
)
-
dispose
IProcessManager.dispose(String, Object)
method implementation.- Specified by:
dispose
in interfaceIProcessManager
- Parameters:
key
- - the specified key for that the object associated with stub is running. (notnull
) Also associated with one remote processstub
- - the stub to release obtained before byIProcessManager.getInstance(String, Class)
method (notnull
)
-