public class CapsuleContainer extends Object implements CapsuleContainerMXBean
| Modifier and Type | Class and Description |
|---|---|
protected static class |
CapsuleContainer.ProcessInfo |
| Modifier and Type | Field and Description |
|---|---|
static String |
CAPSULE_PROCESS_KILLED |
static String |
CAPSULE_PROCESS_LAUNCHED |
| Constructor and Description |
|---|
CapsuleContainer(Path cacheDir)
Constructs a new capsule container
|
| Modifier and Type | Method and Description |
|---|---|
protected ProcessBuilder |
configureCapsuleProcess(ProcessBuilder pb)
May be overridden to pipe app IO streams.
|
protected NotificationBroadcasterSupport |
createEmitter() |
protected String |
createProcessId(String appId,
Process p)
Generates a unique id for a process
|
protected Class<?> |
getMBeanInterface() |
Process |
getProcess(String id) |
Set<String> |
getProcesses()
Returns the IDs of all currently running managed processes.
|
protected Map<String,CapsuleContainer.ProcessInfo> |
getProcessInfo()
Returns information about all managed processes.
|
protected CapsuleContainer.ProcessInfo |
getProcessInfo(String id)
Returns information about a process
|
void |
killProcess(String id)
Kills a managed process
|
String |
launchCapsule(Path capsulePath,
List<String> jvmArgs,
List<String> args)
Launch and monitor a capsule.
|
protected CapsuleContainer.ProcessInfo |
mountProcess(Process p,
String id,
String capsuleId,
List<String> jvmArgs,
List<String> args) |
protected void |
onProcessDeath(String id,
CapsuleContainer.ProcessInfo pi,
int exitValue)
Called a a process has died.
|
protected void |
onProcessLaunch(String id,
CapsuleContainer.ProcessInfo pi)
Called a a process has been launched.
|
public static final String CAPSULE_PROCESS_LAUNCHED
public static final String CAPSULE_PROCESS_KILLED
public CapsuleContainer(Path cacheDir)
cacheDir - the path of the directory to hold capsules' cachesprotected Class<?> getMBeanInterface()
protected NotificationBroadcasterSupport createEmitter()
public String launchCapsule(Path capsulePath, List<String> jvmArgs, List<String> args) throws IOException
capsulePath - the capsule filejvmArgs - the JVM arguments for the capsuleargs - the arguments of the capsule's applicationIOExceptionprotected CapsuleContainer.ProcessInfo mountProcess(Process p, String id, String capsuleId, List<String> jvmArgs, List<String> args) throws IOException, InstanceAlreadyExistsException
protected ProcessBuilder configureCapsuleProcess(ProcessBuilder pb) throws IOException
pb - The capsule's ProcessBuilder.pbIOExceptionprotected void onProcessLaunch(String id, CapsuleContainer.ProcessInfo pi)
id - the process IDpi - the CapsuleContainer.ProcessInfo object for the processprotected void onProcessDeath(String id, CapsuleContainer.ProcessInfo pi, int exitValue)
id - the process IDpi - the CapsuleContainer.ProcessInfo object for the processexitValue - the process's exit valueprotected String createProcessId(String appId, Process p)
appId - the capsule's app IDp - the processprotected final Map<String,CapsuleContainer.ProcessInfo> getProcessInfo()
CapsuleContainer.ProcessInfo objects.protected CapsuleContainer.ProcessInfo getProcessInfo(String id)
id - the process IDCapsuleContainer.ProcessInfo object/public final Process getProcess(String id)
id - the process ID (as returned from launchCapsule.public final Set<String> getProcesses()
getProcesses in interface CapsuleContainerMXBeanpublic final void killProcess(String id)
killProcess in interface CapsuleContainerMXBeanid - the process's ID