Package org.apache.druid.frame.channel
Class WritableFrameFileChannel
- java.lang.Object
-
- org.apache.druid.frame.channel.WritableFrameFileChannel
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,WritableFrameChannel
public class WritableFrameFileChannel extends Object implements WritableFrameChannel
Frame channel backed by aFrameFileWriter
.
-
-
Constructor Summary
Constructors Constructor Description WritableFrameFileChannel(FrameFileWriter writer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Finish writing to this channel.void
fail(Throwable cause)
Called prior toWritableFrameChannel.close()
if the writer has failed.boolean
isClosed()
WhetherWritableFrameChannel.close()
has been called on this channel.com.google.common.util.concurrent.ListenableFuture<?>
writabilityFuture()
Returns a future that resolves whenWritableFrameChannel.write(org.apache.druid.frame.channel.FrameWithPartition)
is able to receive a new frame without blocking or throwing an exception.void
write(FrameWithPartition frame)
Writes a frame with an attached partition number.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.druid.frame.channel.WritableFrameChannel
write
-
-
-
-
Constructor Detail
-
WritableFrameFileChannel
public WritableFrameFileChannel(FrameFileWriter writer)
-
-
Method Detail
-
write
public void write(FrameWithPartition frame) throws IOException
Description copied from interface:WritableFrameChannel
Writes a frame with an attached partition number. May throw an exception ifWritableFrameChannel.writabilityFuture()
is unresolved.- Specified by:
write
in interfaceWritableFrameChannel
- Throws:
IOException
-
fail
public void fail(@Nullable Throwable cause) throws IOException
Description copied from interface:WritableFrameChannel
Called prior toWritableFrameChannel.close()
if the writer has failed. Must be followed by a call toWritableFrameChannel.close()
.- Specified by:
fail
in interfaceWritableFrameChannel
- Parameters:
cause
- optional cause of failure. Used by the in-memory channelBlockingQueueFrameChannel.Writable
to propagate exeptions to downstream processors. Most other channels ignore the provided cause.- Throws:
IOException
-
close
public void close() throws IOException
Description copied from interface:WritableFrameChannel
Finish writing to this channel. When this method is called withoutWritableFrameChannel.fail(Throwable)
having previously been called, the writer is understood to have completed successfully. After calling this method, no additional calls toWritableFrameChannel.write(org.apache.druid.frame.channel.FrameWithPartition)
,WritableFrameChannel.fail(Throwable)
, or this method are permitted.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceWritableFrameChannel
- Throws:
IOException
-
isClosed
public boolean isClosed()
Description copied from interface:WritableFrameChannel
WhetherWritableFrameChannel.close()
has been called on this channel.- Specified by:
isClosed
in interfaceWritableFrameChannel
-
writabilityFuture
public com.google.common.util.concurrent.ListenableFuture<?> writabilityFuture()
Description copied from interface:WritableFrameChannel
Returns a future that resolves whenWritableFrameChannel.write(org.apache.druid.frame.channel.FrameWithPartition)
is able to receive a new frame without blocking or throwing an exception. The future never resolves to an exception.- Specified by:
writabilityFuture
in interfaceWritableFrameChannel
-
-