com.cloudera.sqoop.util
Class Executor

java.lang.Object
  extended by com.cloudera.sqoop.util.Executor

public final class Executor
extends java.lang.Object

Runs a process via Runtime.exec() and allows handling of stdout/stderr to be deferred to other threads.


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Method Summary
static int exec(java.lang.String[] args)
          Execute a program defined by the args array with default stream sinks that consume the program's output (to prevent it from blocking on buffers) and then ignore said output.
static int exec(java.lang.String[] args, AsyncSink outSink, AsyncSink errSink)
          Run a command via Runtime.exec(), with its stdout and stderr streams directed to be handled by threads generated by AsyncSinks.
static int exec(java.lang.String[] args, java.lang.String[] envp, AsyncSink outSink, AsyncSink errSink)
          Run a command via Runtime.exec(), with its stdout and stderr streams directed to be handled by threads generated by AsyncSinks.
static java.util.List<java.lang.String> getCurEnvpStrings()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Method Detail

exec

public static int exec(java.lang.String[] args)
                throws java.io.IOException
Execute a program defined by the args array with default stream sinks that consume the program's output (to prevent it from blocking on buffers) and then ignore said output.

Throws:
java.io.IOException

exec

public static int exec(java.lang.String[] args,
                       AsyncSink outSink,
                       AsyncSink errSink)
                throws java.io.IOException
Run a command via Runtime.exec(), with its stdout and stderr streams directed to be handled by threads generated by AsyncSinks. Block until the child process terminates.

Returns:
the exit status of the ran program
Throws:
java.io.IOException

exec

public static int exec(java.lang.String[] args,
                       java.lang.String[] envp,
                       AsyncSink outSink,
                       AsyncSink errSink)
                throws java.io.IOException
Run a command via Runtime.exec(), with its stdout and stderr streams directed to be handled by threads generated by AsyncSinks. Block until the child process terminates. Allows the programmer to specify an environment for the child program.

Returns:
the exit status of the ran program
Throws:
java.io.IOException

getCurEnvpStrings

public static java.util.List<java.lang.String> getCurEnvpStrings()
Returns:
An array formatted correctly for use as an envp based on the current environment for this program.


Copyright © 2010 Cloudera, Inc.