public class TaskEventDispatcher extends Object implements TaskEventPublisher
Backwards events only work for tasks, which produce pipelined results, where both the producing and consuming task are running at the same time.
Constructor and Description |
---|
TaskEventDispatcher() |
Modifier and Type | Method and Description |
---|---|
void |
clearAll()
Removes all registered event handlers.
|
boolean |
publish(ResultPartitionID partitionId,
TaskEvent event)
Publishes the event to the registered
EventListener instances. |
void |
registerPartition(ResultPartitionID partitionId)
Registers the given partition for incoming task events allowing calls to
subscribeToEvent(ResultPartitionID, EventListener, Class) . |
void |
subscribeToEvent(ResultPartitionID partitionId,
EventListener<TaskEvent> eventListener,
Class<? extends TaskEvent> eventType)
Subscribes a listener to this dispatcher for events on a partition.
|
void |
unregisterPartition(ResultPartitionID partitionId)
Removes the given partition from listening to incoming task events, thus forbidding calls to
subscribeToEvent(ResultPartitionID, EventListener, Class) . |
public void registerPartition(ResultPartitionID partitionId)
subscribeToEvent(ResultPartitionID, EventListener, Class)
.partitionId
- the partition IDpublic void unregisterPartition(ResultPartitionID partitionId)
subscribeToEvent(ResultPartitionID, EventListener, Class)
.partitionId
- the partition IDpublic void subscribeToEvent(ResultPartitionID partitionId, EventListener<TaskEvent> eventListener, Class<? extends TaskEvent> eventType)
partitionId
- ID of the partition to subscribe for (must be registered via registerPartition(ResultPartitionID)
first!)eventListener
- the event listener to subscribeeventType
- event type to subscribe topublic boolean publish(ResultPartitionID partitionId, TaskEvent event)
EventListener
instances.
This method is either called directly from a LocalInputChannel
or the network I/O
thread on behalf of a RemoteInputChannel
.
publish
in interface TaskEventPublisher
partitionId
- the partition ID to get registered handlersevent
- the task event to be published to the handlersregisterPartition(ResultPartitionID)
) or notpublic void clearAll()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.