Class TaskEventDispatcher
java.lang.Object
org.apache.flink.runtime.io.network.TaskEventDispatcher
- All Implemented Interfaces:
TaskEventPublisher
The task event dispatcher dispatches events flowing backwards from a consuming task to the task
producing the consumed result.
Backwards events only work for tasks, which produce pipelined results, where both the producing and consuming task are running at the same time.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearAll()Removes all registered event handlers.booleanpublish(ResultPartitionID partitionId, TaskEvent event) Publishes the event to the registeredEventListenerinstances.voidregisterPartition(ResultPartitionID partitionId) Registers the given partition for incoming task events allowing calls tosubscribeToEvent(ResultPartitionID, EventListener, Class).voidsubscribeToEvent(ResultPartitionID partitionId, EventListener<TaskEvent> eventListener, Class<? extends TaskEvent> eventType) Subscribes a listener to this dispatcher for events on a partition.voidunregisterPartition(ResultPartitionID partitionId) Removes the given partition from listening to incoming task events, thus forbidding calls tosubscribeToEvent(ResultPartitionID, EventListener, Class).
-
Constructor Details
-
TaskEventDispatcher
public TaskEventDispatcher()
-
-
Method Details
-
registerPartition
Registers the given partition for incoming task events allowing calls tosubscribeToEvent(ResultPartitionID, EventListener, Class).- Parameters:
partitionId- the partition ID
-
unregisterPartition
Removes the given partition from listening to incoming task events, thus forbidding calls tosubscribeToEvent(ResultPartitionID, EventListener, Class).- Parameters:
partitionId- the partition ID
-
subscribeToEvent
public void subscribeToEvent(ResultPartitionID partitionId, EventListener<TaskEvent> eventListener, Class<? extends TaskEvent> eventType) Subscribes a listener to this dispatcher for events on a partition.- Parameters:
partitionId- ID of the partition to subscribe for (must be registered viaregisterPartition(ResultPartitionID)first!)eventListener- the event listener to subscribeeventType- event type to subscribe to
-
publish
Publishes the event to the registeredEventListenerinstances.This method is either called directly from a
LocalInputChannelor the network I/O thread on behalf of aRemoteInputChannel.- Specified by:
publishin interfaceTaskEventPublisher- Parameters:
partitionId- the partition ID to get registered handlersevent- the task event to be published to the handlers- Returns:
- whether the event was published to a registered event handler (initiated via
registerPartition(ResultPartitionID)) or not
-
clearAll
public void clearAll()Removes all registered event handlers.
-