public final class Printer<T> extends AbstractConsumerStage<T>
Modifier and Type | Field and Description |
---|---|
static String |
ENCODING_UTF8 |
static String |
STREAM_NULL |
static String |
STREAM_STDERR |
static String |
STREAM_STDLOG |
static String |
STREAM_STDOUT |
inputPort
logger
Constructor and Description |
---|
Printer() |
Modifier and Type | Method and Description |
---|---|
protected void |
execute(T object)
Contains the logic of this stage and is invoked (possibly multiple times) by the framework.
|
String |
getEncoding() |
String |
getStreamName() |
boolean |
isAppend() |
void |
onStarting()
Event that is triggered, if all of the following conditions hold:
after passing the validation phase and
after the threads are ready-to-run and
just before the threads execute any stage.
|
void |
onTerminating()
Event that is triggered, if all of the following conditions hold:
while executing the P&F configuration and
after receiving the termination signal.
|
void |
setAppend(boolean append) |
void |
setEncoding(String encoding) |
void |
setStreamName(String streamName) |
createInputPort, execute, getInputPort
abort, addInputPortRemovedListener, addOutputPortRemovedListener, compareAndSetBeingExecuted, createInputPort, createInputPort, createInputPort, createOutputPort, createOutputPort, createOutputPort, createOutputPort, declareActive, declarePassive, executeByFramework, getCurrentState, getId, getInputPorts, getOutputPorts, getOwningThread, getTerminationStrategy, isActive, isBeingExecuted, isPaused, isProducer, isStateless, onSignal, onValidating, removeDynamicPort, removeDynamicPort, setPaused, setStateless, shouldBeTerminated, signalAlreadyReceived, terminateStage, toString, workCompleted
public static final String STREAM_STDOUT
public static final String STREAM_STDERR
public static final String STREAM_STDLOG
public static final String STREAM_NULL
public static final String ENCODING_UTF8
protected void execute(T object)
AbstractConsumerStage
execute
in class AbstractConsumerStage<T>
object
- the next non-null element from the (only) input port of this stagepublic String getStreamName()
public void setStreamName(String streamName)
public String getEncoding()
public void setEncoding(String encoding)
public boolean isAppend()
public void setAppend(boolean append)
public void onStarting()
AbstractStage
If stage developers want to override this method, they must always call the super implementation first:
@Override protected void onStarting() { super.onStarting(); // insert your code here }
To throw a checked exception, wrap it to an unchecked exception, e.g. to an
IllegalArgumentException.IllegalArgumentException(String, Throwable)
.
Always pass the original exception to the new unchecked exception to allow easy debugging.
onStarting
in class AbstractStage
public void onTerminating()
AbstractStage
If stage developers want to override this method, they must always call the super implementation last:
@Override protected void onTerminating() { // insert your code here super.onTerminating(); }
To throw a checked exception, wrap it to an unchecked exception, e.g. to an IllegalArgumentException.IllegalArgumentException(String, Throwable)
.
Always pass the original exception to the new unchecked exception to allow easy debugging.
onTerminating
in class AbstractStage
Copyright © 2015–2020. All rights reserved.