Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

oracle.jbo.server.util
Class SafeExec

java.lang.Object
  extended byoracle.jbo.server.util.SafeExec

public class SafeExec
extends java.lang.Object

Executes a subprocess in a separate thread, and monitors the executing subprocess. The output can be captured and redirected to a stream. Also, the subprocess is given a finite amount of time to complete, and will be forcibly terminated if it doesn't complete within the timeout. This class is used by the BC4J test framework to deal with errant tests that don't terminate, but it is a standalone utility that can be used anywhere.

Since:
3.1

Field Summary
static int DEFAULT_TIMEOUT
          default timeout in seconds if nothing else specified
static int ERROR_COULD_NOT_EXEC
           
static int ERROR_TIMED_OUT
          error code to use if the process times out
static java.lang.String HLINE
           
static java.lang.String PROP_DIAGNOSTICS
           
static java.lang.String PROP_TIMEOUT
           
 
Constructor Summary
SafeExec()
           
 
Method Summary
static long getTimeoutMillis()
           
static void main(java.lang.String[] args)
          execute runProc
static int monitorProc(java.lang.Process proc, java.io.PrintStream logConsole, long timeout)
          Given a running process, monitor its progress, and time it out after timeout ms.
static int runProc(java.lang.String[] args, java.io.PrintStream logConsole)
           
static int runProc(java.lang.String[] args, java.io.PrintStream logConsole, long timeout)
          Execute a subprocess defined by the contents of 'args'.
static int runProc(java.lang.String cmdline, java.io.PrintStream logConsole)
           
static int runProc(java.lang.String cmdline, java.io.PrintStream logConsole, long timeout)
          Execute a subprocess defined by the contents of 'cmdline'
static void traceln(java.lang.String message)
           
static void Usage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_TIMEOUT

public static final java.lang.String PROP_TIMEOUT
See Also:
Constant Field Values

PROP_DIAGNOSTICS

public static final java.lang.String PROP_DIAGNOSTICS
See Also:
Constant Field Values

HLINE

public static final java.lang.String HLINE
See Also:
Constant Field Values

ERROR_TIMED_OUT

public static final int ERROR_TIMED_OUT
error code to use if the process times out

See Also:
Constant Field Values

ERROR_COULD_NOT_EXEC

public static final int ERROR_COULD_NOT_EXEC
See Also:
Constant Field Values

DEFAULT_TIMEOUT

public static final int DEFAULT_TIMEOUT
default timeout in seconds if nothing else specified

See Also:
Constant Field Values
Constructor Detail

SafeExec

public SafeExec()
Method Detail

getTimeoutMillis

public static long getTimeoutMillis()

main

public static void main(java.lang.String[] args)
execute runProc


runProc

public static int runProc(java.lang.String[] args,
                          java.io.PrintStream logConsole,
                          long timeout)
Execute a subprocess defined by the contents of 'args'. returns the error code of the completed process, or SafeExec.ERROR_TIMED_OUT or SafeExexc.ERROR_COULD_NOT_EXEC


runProc

public static int runProc(java.lang.String cmdline,
                          java.io.PrintStream logConsole,
                          long timeout)
Execute a subprocess defined by the contents of 'cmdline'


monitorProc

public static int monitorProc(java.lang.Process proc,
                              java.io.PrintStream logConsole,
                              long timeout)
Given a running process, monitor its progress, and time it out after timeout ms.


runProc

public static int runProc(java.lang.String[] args,
                          java.io.PrintStream logConsole)

runProc

public static int runProc(java.lang.String cmdline,
                          java.io.PrintStream logConsole)

traceln

public static void traceln(java.lang.String message)

Usage

public static void Usage()

Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

 

Copyright © 1997, 2004, Oracle. All rights reserved.