T
- The type of the element handled by the emitter.public class OutputEmitter<T> extends Object implements ChannelSelector<SerializationDelegate<T>>
Constructor and Description |
---|
OutputEmitter(ShipStrategyType strategy,
int indexInSubtaskGroup)
Creates a new channel selector that uses the given strategy (broadcasting, partitioning, ...)
and uses the supplied task index perform a round robin distribution.
|
OutputEmitter(ShipStrategyType strategy,
int indexInSubtaskGroup,
TypeComparator<T> comparator,
Partitioner<?> partitioner,
DataDistribution distribution) |
OutputEmitter(ShipStrategyType strategy,
TypeComparator<T> comparator)
Creates a new channel selector that uses the given strategy (broadcasting, partitioning, ...)
and uses the supplied comparator to hash / compare records for partitioning them deterministically.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isBroadcast()
Returns whether the channel selector always selects all the output channels.
|
int |
selectChannel(SerializationDelegate<T> record)
Returns the logical channel index, to which the given record should be written.
|
void |
setup(int numberOfChannels)
Initializes the channel selector with the number of output channels.
|
public OutputEmitter(ShipStrategyType strategy, int indexInSubtaskGroup)
strategy
- The distribution strategy to be used.public OutputEmitter(ShipStrategyType strategy, TypeComparator<T> comparator)
strategy
- The distribution strategy to be used.comparator
- The comparator used to hash / compare the records.public OutputEmitter(ShipStrategyType strategy, int indexInSubtaskGroup, TypeComparator<T> comparator, Partitioner<?> partitioner, DataDistribution distribution)
public void setup(int numberOfChannels)
ChannelSelector
setup
in interface ChannelSelector<SerializationDelegate<T>>
numberOfChannels
- the total number of output channels which are attached
to respective output gate.public final int selectChannel(SerializationDelegate<T> record)
ChannelSelector
UnsupportedOperationException
).selectChannel
in interface ChannelSelector<SerializationDelegate<T>>
record
- the record to determine the output channels for.public boolean isBroadcast()
ChannelSelector
isBroadcast
in interface ChannelSelector<SerializationDelegate<T>>
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.