org.exolab.jmscts.core
Class AsyncExecutor

java.lang.Object
  |
  +--org.exolab.jmscts.core.AsyncExecutor

public class AsyncExecutor
extends java.lang.Object

This class enables java applications to be executed asynchronously, with the output being captured, or echoed to System.out and System.err Clients can register a listener to be notified when the application starts and stops.

Version:
$Revision: 1.4 $ $Date: 2004/02/03 21:52:06 $
Author:
Tim Anderson
See Also:
Executor, ExecutionListener

Constructor Summary
AsyncExecutor(java.lang.Class application, java.lang.String arguments, int port)
          Constructor to execute a command, with output going to System.out and System.err
AsyncExecutor(java.lang.Class application, java.lang.String arguments, java.io.OutputStream out, int port)
          Constructor to execute a command, with all output going to a stream
AsyncExecutor(java.lang.Class application, java.lang.String arguments, java.io.OutputStream out, java.io.OutputStream err, int port)
          Constructor to execute a command with standard output and error output going to two separate streams
 
Method Summary
 void addListener(ExecutionListener listener)
          Add a listener to monitor for execution events
 void removeListener(ExecutionListener listener)
          Remove a listener
 void run()
          Execute the command in a separate thread.
 void stop()
          Stop the process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncExecutor

public AsyncExecutor(java.lang.Class application,
                     java.lang.String arguments,
                     int port)
Constructor to execute a command, with output going to System.out and System.err
Parameters:
application - the class of the application to execute
arguments - any arguments to pass to the application
port - the RMI registry port

AsyncExecutor

public AsyncExecutor(java.lang.Class application,
                     java.lang.String arguments,
                     java.io.OutputStream out,
                     int port)
Constructor to execute a command, with all output going to a stream
Parameters:
application - the class of the application to execute
arguments - any arguments to pass to the application
out - the stream to log output to
port - the RMI registry port

AsyncExecutor

public AsyncExecutor(java.lang.Class application,
                     java.lang.String arguments,
                     java.io.OutputStream out,
                     java.io.OutputStream err,
                     int port)
Constructor to execute a command with standard output and error output going to two separate streams
Parameters:
application - the class of the application to execute
arguments - any arguments to pass to the application
out - the stream to direct standard output to
err - the stream to direct standard error to
port - the RMI registry port
Method Detail

addListener

public void addListener(ExecutionListener listener)
Add a listener to monitor for execution events
Parameters:
listener - the listener to add

removeListener

public void removeListener(ExecutionListener listener)
Remove a listener
Parameters:
listener - the listener to remove

run

public void run()
Execute the command in a separate thread. This method returns immediately

stop

public void stop()
Stop the process


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.