org.apache.pig.impl.streaming
Class ExecutableManager

java.lang.Object
  extended by org.apache.pig.impl.streaming.ExecutableManager
Direct Known Subclasses:
HadoopExecutableManager

public class ExecutableManager
extends Object

ExecutableManager manages an external executable which processes data in a Pig query. The ExecutableManager is responsible for startup/teardown of the external process and also for managing it. It feeds input records to the executable via it's stdin, collects the output records from the stdout and also diagnostic information from the stdout.


Field Summary
protected  StreamingCommand command
           
protected  int exitCode
           
protected  long inputBytes
           
protected  long inputRecords
           
protected  Throwable outerrThreadsError
           
protected  long outputBytes
           
protected  long outputRecords
           
protected  DataOutputStream stdin
           
 
Constructor Summary
ExecutableManager()
          Create a new ExecutableManager.
 
Method Summary
 void close()
          Close and cleanup the ExecutableManager.
 void configure(POStream stream)
          Configure and initialize the ExecutableManager.
protected  void exec()
          Start execution of the external process.
protected  void processError(String error)
          Workhorse to process the stderr stream of the managed process.
 void run()
          Start execution of the ExecutableManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

command

protected StreamingCommand command

exitCode

protected int exitCode

stdin

protected DataOutputStream stdin

inputRecords

protected long inputRecords

inputBytes

protected long inputBytes

outputRecords

protected long outputRecords

outputBytes

protected long outputBytes

outerrThreadsError

protected volatile Throwable outerrThreadsError
Constructor Detail

ExecutableManager

public ExecutableManager()
Create a new ExecutableManager.

Method Detail

configure

public void configure(POStream stream)
               throws IOException,
                      ExecException
Configure and initialize the ExecutableManager.

Parameters:
stream - POStream operator
Throws:
IOException
ExecException

close

public void close()
           throws IOException
Close and cleanup the ExecutableManager.

Throws:
IOException

exec

protected void exec()
             throws IOException
Start execution of the external process. This takes care of setting up the environment of the process and also starts ProcessErrorThread to process the stderr of the managed process.

Throws:
IOException

run

public void run()
         throws IOException
Start execution of the ExecutableManager.

Throws:
IOException

processError

protected void processError(String error)
Workhorse to process the stderr stream of the managed process. By default ExecuatbleManager just sends out the received error message to the stderr of itself.

Parameters:
error - error message from the managed process.


Copyright © 2007-2012 The Apache Software Foundation