|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.tanukisoftware.wrapper.WrapperProcessConfig
public final class WrapperProcessConfig
With WrapperProcessConfig Class the startup configuration for the Process can be passed to the WrapperManager.exec methods. The configuration makes it possible to control the way the OS spawns the child process, specify environment variables, working directory, and how the Wrapper should handle process when the JVM exits. Please review each of the methods a more detailed explanation of how they work.
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 ) );
Field Summary | |
---|---|
static int |
DYNAMIC
|
static int |
FORK_EXEC
|
static int |
POSIX_SPAWN
|
static int |
VFORK_EXEC
|
Constructor Summary | |
---|---|
WrapperProcessConfig()
Creates a default configuration. |
Method Summary | |
---|---|
Map |
getEnvironment()
Returns a Map containing the environment which will be used to launch the child process. |
int |
getStartType()
Returns the start type. |
File |
getWorkingDirectory()
Returns the working directory. |
boolean |
isDetached()
Returns the detached flag. |
static boolean |
isSupported(int startType)
Indicates whether the specified start type is supported on the current plattform. |
WrapperProcessConfig |
setDetached(boolean detached)
Sets the detached flag. |
WrapperProcessConfig |
setEnvironment(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(File workingDirectory)
Sets the working directory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int POSIX_SPAWN
public static final int FORK_EXEC
public static final int VFORK_EXEC
public static final int DYNAMIC
Constructor Detail |
---|
public WrapperProcessConfig()
WrapperLicenseError
- If the Professional Edition of the Wrapper
is not being used.Method Detail |
---|
public static boolean isSupported(int startType) throws WrapperLicenseError, IllegalArgumentException
startType
- The start type to test.
WrapperLicenseError
- If the function is called other than in
the Professional Edition or from a Standalone JVM.
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 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.
IllegalArgumentException
- If the startType is invalid.public File getWorkingDirectory()
public WrapperProcessConfig setWorkingDirectory(File workingDirectory) throws 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.
IOException
- If the specified working directory can not be resolved.public 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(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.
IllegalArgumentException
- If any of the names or values are not
Strings or if a name is empty.public WrapperProcessConfig setSoftShutdownTimeout(int softShutdownTimeout) throws IOException
softShutdownTimeout
- The max timeout for an application to stop, before
killing forcibly
IllegalArgumentException
- If the value of the specified timeout is invalid.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |