Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Business Components
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.jbo.server.util
Class SafeExec

    java.lang.Object
      |
      +--oracle.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
Version:
  1.0

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

### PROP_DIAGNOSTICS

    public static final java.lang.String PROP_DIAGNOSTICS

### HLINE

    public static final java.lang.String HLINE

### ERROR_TIMED_OUT

    public static final int ERROR_TIMED_OUT

  error code to use if the process times out

### ERROR_COULD_NOT_EXEC

    public static final int ERROR_COULD_NOT_EXEC

### DEFAULT_TIMEOUT

    public static final int DEFAULT_TIMEOUT

  default timeout in seconds if nothing else specified

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()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Business Components
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD