public class SingleRecordWriter<T extends IOReadableWritable> extends Object implements RecordWriterDelegate<T>
AvailabilityProvider.AvailabilityHelper
AVAILABLE
Constructor and Description |
---|
SingleRecordWriter(RecordWriter<T> recordWriter) |
Modifier and Type | Method and Description |
---|---|
void |
broadcastEvent(AbstractEvent event)
Broadcasts the provided event to all the internal record writer instances.
|
void |
close() |
CompletableFuture<?> |
getAvailableFuture() |
RecordWriter<T> |
getRecordWriter(int outputIndex)
Returns the internal actual record writer instance based on the output index.
|
boolean |
isAvailable()
In order to best-effort avoid volatile access in
CompletableFuture.isDone() , we check
the condition of future == AVAILABLE firstly for getting probable performance
benefits while hot looping. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
and, isApproximatelyAvailable, or
public SingleRecordWriter(RecordWriter<T> recordWriter)
public void broadcastEvent(AbstractEvent event) throws IOException
RecordWriterDelegate
broadcastEvent
in interface RecordWriterDelegate<T extends IOReadableWritable>
event
- the event to be emitted to all the output channels.IOException
public RecordWriter<T> getRecordWriter(int outputIndex)
RecordWriterDelegate
getRecordWriter
in interface RecordWriterDelegate<T extends IOReadableWritable>
outputIndex
- the index respective to the record writer instance.public CompletableFuture<?> getAvailableFuture()
getAvailableFuture
in interface AvailabilityProvider
public boolean isAvailable()
AvailabilityProvider
CompletableFuture.isDone()
, we check
the condition of future == AVAILABLE
firstly for getting probable performance
benefits while hot looping.
It is always safe to use this method in performance nonsensitive scenarios to get the precise state.
isAvailable
in interface AvailabilityProvider
public void close()
close
in interface AutoCloseable
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.