|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rioproject.exec.ServiceExecutor
public class ServiceExecutor
Provides support to execute an external service. If the external service is a Java Virtual Machine, this utility will try to attach to the Java Virtual Machine using the JMX Attach API. This is only possible using Java 6 or greater. If the runtime is Java 5, external service utilization monitoring is not provided.
In order to obtain the process identifier required to attach to the exec'd JVM, the external process may create a pid file, containing the process identifier of the process. If this is the case, then configuring the deployment to declare the path of the produced pid file can be done.
If the exec'd process does not create a pid file,
SIGAR
is used to traverse the process tree to identify the parent process that
exec'd the child JVM. If the parent process can be identified
(see SigarHelper.matchChild(int, java.lang.String[]) the
ServiceExecutor will attach to the JVM, and monitor CPU and Memory
utilization. SIGAR
is also used to monitor the real memory used by the exec'd JVM.
This class also provides configuration support for the following entries:
|
Type: |
String |
|
Default: |
exec-template.sh |
|
Description: |
The template to use for
generating a script to exec a command. The script template must be
loadable as a resource, and must provide the following token that get
replaced by runtime values: ${command} The command to execute. This token eirs placed by the command to execute. ${pidFile} Rio creates a file that stores the pid of the executed command. This token is replaced by the name of the pid file to create ${commandLine} This token is replaced by the actual command line that is created to 'exec' the command above. Inoput arguments, standard error and output are also part of the created command line |
|
Type: |
int |
|
Default: |
60 |
|
Description: |
The amount of time to wait for an exec'd service to create a pid file.
The value is in seconds, where 60 seconds is the default. The minimum
value for this property is 5 seconds, the maximum allowed 5 minutes. This value represents the maximum amount of time to wait. If the pid file is created prior to the timeout value, the utility proceeds immediately. |
Notes:
| Constructor Summary | |
|---|---|
ServiceExecutor()
|
|
| Method Summary | |
|---|---|
ProcessManager |
exec()
|
ProcessManager |
exec(ExecDescriptor exDesc)
|
ComputeResourceUtilization |
getComputeResourceUtilization()
|
static void |
main(String[] args)
|
void |
preDestroy()
|
long |
readPidFromFile(File f)
|
void |
setExecDescriptor(ExecDescriptor execDescriptor)
|
void |
setServiceBean(ServiceBean serviceBean)
|
void |
setServiceBeanContext(ServiceBeanContext context)
|
void |
terminate()
Close the shell and release all used resources |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ServiceExecutor()
| Method Detail |
|---|
public void setServiceBeanContext(ServiceBeanContext context)
throws JSBInstantiationException,
IOException,
ConfigurationException
JSBInstantiationException
IOException
ConfigurationExceptionpublic ComputeResourceUtilization getComputeResourceUtilization()
public void setExecDescriptor(ExecDescriptor execDescriptor)
public void setServiceBean(ServiceBean serviceBean)
public void preDestroy()
public ProcessManager exec()
throws IOException
IOException
public ProcessManager exec(ExecDescriptor exDesc)
throws IOException
IOExceptionpublic void terminate()
public long readPidFromFile(File f)
throws IOException
IOExceptionpublic static void main(String[] args)
|
Copyright © Rio Project. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||