@Internal public final class StreamTaskNetworkInput extends Object implements StreamTaskInput
StreamTaskInput
that wraps an input from network taken from CheckpointedInputGate
.UNSPECIFIED
AVAILABLE
Constructor and Description |
---|
StreamTaskNetworkInput(CheckpointedInputGate checkpointedInputGate,
TypeSerializer<?> inputSerializer,
IOManager ioManager,
int inputIndex) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
getInputIndex()
Returns the input index of this input.
|
int |
getLastChannel() |
CompletableFuture<?> |
isAvailable()
Check if this instance is available for further processing.
|
boolean |
isFinished() |
StreamElement |
pollNextNullable()
Poll the next element.
|
public StreamTaskNetworkInput(CheckpointedInputGate checkpointedInputGate, TypeSerializer<?> inputSerializer, IOManager ioManager, int inputIndex)
@Nullable public StreamElement pollNextNullable() throws Exception
NullableAsyncDataInput
pollNextNullable
in interface NullableAsyncDataInput<StreamElement>
null
will be returned if there is no data to return or
if AvailabilityListener.isFinished()
returns true. Otherwise return element
.Exception
public int getLastChannel()
getLastChannel
in interface StreamTaskInput
StreamElement
, or StreamTaskInput.UNSPECIFIED
if
it is unspecified.public int getInputIndex()
StreamTaskInput
getInputIndex
in interface StreamTaskInput
public boolean isFinished()
isFinished
in interface AvailabilityListener
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
AvailabilityListener.AVAILABLE
should be returned. Previously returned
not completed futures should become completed once there is more input available or if
the input AvailabilityListener.isFinished()
.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.