public class InputGateWithMetrics extends InputGate
InputGate
provided by shuffle service and it is mainly
used for increasing general input metrics from TaskIOMetricGroup
.InputGate.InputWithData<INPUT,DATA>
isAvailable
AVAILABLE
Constructor and Description |
---|
InputGateWithMetrics(InputGate inputGate,
Counter numBytesIn) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
Optional<BufferOrEvent> |
getNext()
Blocking call waiting for next
BufferOrEvent . |
int |
getNumberOfInputChannels() |
CompletableFuture<?> |
isAvailable()
Check if this instance is available for further processing.
|
boolean |
isFinished() |
Optional<BufferOrEvent> |
pollNext()
Poll the
BufferOrEvent . |
void |
sendTaskEvent(TaskEvent event) |
void |
setup()
Setup gate, potentially heavy-weight, blocking operation comparing to just creation.
|
resetIsAvailable
public CompletableFuture<?> isAvailable()
AvailabilityListener
When hot looping to avoid volatile access in CompletableFuture.isDone()
user of
this method should do the following check:
AvailabilityListener input = ...;
if (input.isAvailable() == AvailabilityListener.AVAILABLE || input.isAvailable().isDone()) {
// do something;
}
isAvailable
in interface AvailabilityListener
isAvailable
in class InputGate
AvailabilityListener.AVAILABLE
should be returned. Previously returned
not completed futures should become completed once there are more records available.public int getNumberOfInputChannels()
getNumberOfInputChannels
in class InputGate
public boolean isFinished()
isFinished
in interface AvailabilityListener
isFinished
in class InputGate
public void setup() throws IOException, InterruptedException
InputGate
setup
in class InputGate
IOException
InterruptedException
public Optional<BufferOrEvent> getNext() throws IOException, InterruptedException
InputGate
BufferOrEvent
.getNext
in class InputGate
Optional.empty()
if InputGate.isFinished()
returns true.IOException
InterruptedException
public Optional<BufferOrEvent> pollNext() throws IOException, InterruptedException
InputGate
BufferOrEvent
.pollNext
in interface AsyncDataInput<BufferOrEvent>
pollNext
in class InputGate
Optional.empty()
if there is no data to return or if InputGate.isFinished()
returns true.IOException
InterruptedException
public void sendTaskEvent(TaskEvent event) throws IOException
sendTaskEvent
in class InputGate
IOException
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.