|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pig.impl.streaming.ExecutableManager
public class ExecutableManager
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 |
add(Datum d)
Send the given Datum to the external command managed by the
ExecutableManager . |
void |
close()
Close and cleanup the ExecutableManager . |
void |
configure(Properties properties,
StreamingCommand command,
DataCollector endOfPipe)
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. |
protected void |
processOutput(Datum d)
Workhorse to process the output of the managed process. |
void |
run()
Start execution of the ExecutableManager . |
protected void |
setupEnvironment(ProcessBuilder pb)
Set up the run-time environment of the managed process. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected StreamingCommand command
protected int exitCode
protected DataOutputStream stdin
protected long inputRecords
protected long inputBytes
protected long outputRecords
protected long outputBytes
protected volatile Throwable outerrThreadsError
Constructor Detail |
---|
public ExecutableManager()
ExecutableManager
.
Method Detail |
---|
public void configure(Properties properties, StreamingCommand command, DataCollector endOfPipe) throws IOException, ExecException
ExecutableManager
.
properties
- Properties
for the
ExecutableManager
command
- StreamingCommand
to be run by the
ExecutableManager
endOfPipe
- DataCollector
to be used to push results of the
StreamingCommand
down
IOException
ExecException
public void close() throws IOException, ExecException
ExecutableManager
.
IOException
ExecException
protected void setupEnvironment(ProcessBuilder pb)
pb
- ProcessBuilder
used to exec the processprotected void exec() throws IOException
ProcessErrorThread
to process the stderr
of
the managed process.
IOException
public void run() throws IOException
ExecutableManager
.
IOException
public void add(Datum d) throws IOException
Datum
to the external command managed by the
ExecutableManager
.
d
- Datum
to be sent to the external command
IOException
protected void processOutput(Datum d)
ExecutableManager
, by default, just pushes the received
Datum
into eval-pipeline to be processed by the successor.
d
- Datum
to processprotected void processError(String error)
ExecuatbleManager
just sends out the received
error message to the stderr
of itself.
error
- error message from the managed process.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |