org.openmdx.kernel.application.process
Class Subprocess

java.lang.Object
  extended by java.lang.Thread
      extended by org.openmdx.kernel.application.process.Subprocess
All Implemented Interfaces:
Runnable

public class Subprocess
extends Thread

Subprocess


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static Integer SUCCESS
          The exit and run value for success.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Subprocess(Process process, Character notification)
          Deprecated. in favour of the constructor including an explicit output and exception stream.
Subprocess(Process process, Character notification, OutputStream outputStream, OutputStream errorStream)
          Constructor
 
Method Summary
 void destroy()
          Kills the subprocess
 Integer exitValue()
          Retrieve the subprocess' exit value.
static Subprocess fork(String jre, String classpath, String[] options, Map properties, String className, String[] arguments, Character synchronization)
          Deprecated. in favour of the fork method including an explicit output and exception stream.
static Subprocess fork(String jre, String classpath, String[] options, Map properties, String className, String[] arguments, Character synchronization, OutputStream outputStream, OutputStream exceptionStream)
          Fork a Java process
 void run()
           
 Integer runValue()
          Tells whether the sub-process is active and has notified the launcher via it's exception stream.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SUCCESS

public static final Integer SUCCESS
The exit and run value for success.

Constructor Detail

Subprocess

public Subprocess(Process process,
                  Character notification,
                  OutputStream outputStream,
                  OutputStream errorStream)
Constructor

Parameters:
process -
notification - The signal character or null
outputStream - The stream obtains data piped from the standard output stream of the process represented by this Subprocess object; or null to discard the data.
exceptionStream - The stream obtains data piped from the error output stream of the process represented by this Subprocess object; or null to discard the data.

Subprocess

public Subprocess(Process process,
                  Character notification)
Deprecated. in favour of the constructor including an explicit output and exception stream.

Constructor

Parameters:
process -
notification - The signal character or null
Method Detail

fork

public static Subprocess fork(String jre,
                              String classpath,
                              String[] options,
                              Map properties,
                              String className,
                              String[] arguments,
                              Character synchronization,
                              OutputStream outputStream,
                              OutputStream exceptionStream)
                       throws IOException,
                              InterruptedException
Fork a Java process

Parameters:
jre - the JRE directory. Optional, defaults to the "java.home" system property.
classpath - the class-path. Optional, defaults to the "java.class.path" system property.
options - additional Java VM Options. Optional.
properties - the system properties to be set. Optional, defaults to "org.openmdx.rmi.naming.service" and "org.openmdx.rmi.registry.port" retrieved from Contexts.
arguments - Program arguments
synchronization - Fork waits until the subprocess has terminated or the synchronization character has been sent either to the subprocess' error or output stream unless synchronization is null.
outputStream - The stream obtains data piped from the standard output stream of the process represented by this Subprocess object; or null to discard the data.
exceptionStream - The stream obtains data piped from the error output stream of the process represented by this Subprocess object; or null to discard the data.
Returns:
the LightweightContainer's Process
Throws:
IOException
InterruptedException

fork

public static Subprocess fork(String jre,
                              String classpath,
                              String[] options,
                              Map properties,
                              String className,
                              String[] arguments,
                              Character synchronization)
                       throws IOException,
                              InterruptedException
Deprecated. in favour of the fork method including an explicit output and exception stream.

Fork a Java process

Parameters:
jre - the JRE directory. Optional, defaults to the "java.home" system property.
classpath - the class-path. Optional, defaults to the "java.class.path" system property.
options - additional Java VM Options. Optional.
properties - the system properties to be set. Optional, defaults to "org.openmdx.rmi.naming.service" and "org.openmdx.rmi.registry.port" retrieved from Contexts.
arguments - Program arguments
synchronization - Fork waits until the subprocess has terminated or the synchronization character has been sent either to the subprocess' error or output stream unless synchronization is null.
Returns:
the LightweightContainer's Process
Throws:
IOException
InterruptedException

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

exitValue

public Integer exitValue()
Retrieve the subprocess' exit value.

Returns:
the subprocess' exit value; or null if the subprocess has not yet terminated

runValue

public Integer runValue()
Tells whether the sub-process is active and has notified the launcher via it's exception stream.

Returns:
  • 0 if the sub-process is alive and has notified the launcher via it's output stream
  • 1 if the sub-process is alive and has notified the launcher via it's exception stream
  • code>null the sub-process is no longer alive or the notification character is null or the current thread is interrupted

destroy

public void destroy()
Kills the subprocess

Overrides:
destroy in class Thread


This software is published under the BSD license. Copyright © 2003-2007, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.