public final class WrapperProcessConfig
extends java.lang.Object
The setter methods are designed to be optionally be chained as follows:
WrapperProcess proc = WrapperManager.exec( "command", new WrapperProcessConfig().setDetached( true ).setStartType( WrapperProcessConfig.POSIX_SPAWN ) );
Modifier and Type | Field and Description |
---|---|
static int |
DYNAMIC |
static int |
FORK_EXEC |
static int |
POSIX_SPAWN |
static int |
VFORK_EXEC |
Constructor and Description |
---|
WrapperProcessConfig()
Creates a default configuration.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map |
getEnvironment()
Returns a Map containing the environment which will be used to launch
the child process.
|
int |
getStartType()
Returns the start type.
|
java.io.File |
getWorkingDirectory()
Returns the working directory.
|
boolean |
isCreateForActiveUser()
Tells if the CreateForActiveUser feature was enabled.
|
boolean |
isDetached()
Returns the detached flag.
|
static boolean |
isSupported(int startType)
Indicates whether the specified start type is supported on the current
plattform.
|
WrapperProcessConfig |
setCreateForActiveUser(boolean isInteractive)
Specifies if the ChildProcesses should be launched
in the current session.
|
WrapperProcessConfig |
setDetached(boolean detached)
Sets the detached flag.
|
WrapperProcessConfig |
setEnvironment(java.util.Map environment)
Sets the environment for the child process.
|
WrapperProcessConfig |
setSoftShutdownTimeout(int softShutdownTimeout)
Sets the timeout for the soft shtudown in seconds.
|
WrapperProcessConfig |
setStartType(int startType)
Sets the start type.
|
WrapperProcessConfig |
setWorkingDirectory(java.io.File workingDirectory)
Sets the working directory.
|
public static final int POSIX_SPAWN
public static final int FORK_EXEC
public static final int VFORK_EXEC
public static final int DYNAMIC
public WrapperProcessConfig()
WrapperLicenseError
- If the function is called other than in
the Professional Edition or if the native
library has not been loaded.public static boolean isSupported(int startType) throws WrapperLicenseError, java.lang.IllegalArgumentException
startType
- The start type to test.WrapperLicenseError
- If the function is called other than in
the Professional Edition or if the native
library has not been loaded.java.lang.IllegalArgumentException
- If the startType is invalid.public boolean isDetached()
public WrapperProcessConfig setDetached(boolean detached)
detached
- If false the Wrapper will remember that the process was
launched and then make sure that it is terminated when
the JVM exits.public int getStartType()
public WrapperProcessConfig setStartType(int startType) throws java.lang.IllegalArgumentException
The start type is used to control how the subprocess will be started by the OS. This property has no effect on Windows.
startType
- The start type to use when launching the child process.java.lang.IllegalArgumentException
- If the startType is invalid.public java.io.File getWorkingDirectory()
public WrapperProcessConfig setWorkingDirectory(java.io.File workingDirectory) throws java.io.IOException
workingDirectory
- The working directory of the subprocess, or null
if the subprocess should inherit the working
directory of the JVM.
Please note, when using the POSIX_SPAWN or DYNAMIC start
type, it is not possible to set the working
directory. Doing so will result in an error when running exec.java.io.IOException
- If the specified working directory can not be resolved.public java.util.Map getEnvironment() throws WrapperLicenseError
If this Map is modified those changes will be reflected when the process is launched. Alternately, the environment can be set with the setEnvironment method. Clearing the Map will result in an empty environment being used.
WrapperLicenseError
- If the function is called other than in
the Professional Edition or from a Standalone JVM.public WrapperProcessConfig setEnvironment(java.util.Map environment)
environment
- A Map containing the environment to use when launching
the process. Passing in an empty Map will result in
an empty Environment being used. A null native will
cause the process to be launched using the same
environment as the JVM.java.lang.IllegalArgumentException
- If any of the names or values are not
Strings or if a name is empty.public WrapperProcessConfig setSoftShutdownTimeout(int softShutdownTimeout) throws java.io.IOException
softShutdownTimeout
- The max timeout for an application to stop, before
killing forciblyjava.lang.IllegalArgumentException
- If the value of the specified timeout is invalid.java.io.IOException
public WrapperProcessConfig setCreateForActiveUser(boolean isInteractive)
isInteractive
- true to enable the feature.public boolean isCreateForActiveUser()