T - the record type to be transported from this gate
TODO refactor with changes to input sidepublic abstract class Gate<T extends IOReadableWritable> extends Object
Gate class itself
is abstract. A gate automatically created for every record reader/writer in the user program. A gate can only be used
to transport one specific type of records.
This class in general is not thread-safe.
| Modifier | Constructor and Description |
|---|---|
protected |
Gate(JobID jobID,
GateID gateID,
int index)
Constructs a new abstract gate
|
| Modifier and Type | Method and Description |
|---|---|
void |
deliverEvent(AbstractTaskEvent event) |
ChannelType |
getChannelType() |
protected EventNotificationManager |
getEventNotificationManager()
Returns the event notification manager used to dispatch events.
|
GateID |
getGateID() |
int |
getIndex() |
JobID |
getJobID() |
abstract boolean |
isClosed()
Checks if the gate is closed.
|
abstract boolean |
isInputGate()
Checks if the considered gate is an input gate.
|
abstract void |
publishEvent(AbstractEvent event)
Publishes an event.
|
abstract void |
releaseAllChannelResources()
Releases the allocated resources (particularly buffer) of all channels attached to this gate.
|
void |
setChannelType(ChannelType channelType) |
void |
subscribeToEvent(EventListener eventListener,
Class<? extends AbstractTaskEvent> eventType) |
String |
toString() |
void |
unsubscribeFromEvent(EventListener eventListener,
Class<? extends AbstractTaskEvent> eventType) |
public final int getIndex()
protected final EventNotificationManager getEventNotificationManager()
public final void subscribeToEvent(EventListener eventListener, Class<? extends AbstractTaskEvent> eventType)
public final void unsubscribeFromEvent(EventListener eventListener, Class<? extends AbstractTaskEvent> eventType)
public final void deliverEvent(AbstractTaskEvent event)
public final void setChannelType(ChannelType channelType)
public final ChannelType getChannelType()
public JobID getJobID()
public GateID getGateID()
public abstract void publishEvent(AbstractEvent event) throws IOException, InterruptedException
event - the event to be publishedIOException - thrown if an error occurs while transmitting the eventInterruptedException - thrown if the thread is interrupted while waiting for the event to be publishedpublic abstract void releaseAllChannelResources()
public abstract boolean isClosed()
throws IOException,
InterruptedException
true if the gate is closed, false otherwiseIOException - thrown if any error occurred while closing the gateInterruptedException - thrown if the gate is interrupted while waiting for this operation to completepublic abstract boolean isInputGate()
true if the considered gate is an input gate, false if it is an output gateCopyright © 2015 The Apache Software Foundation. All rights reserved.