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 voidclose()Finish writing to this channel.voidfail(Throwable cause)Called prior toWritableFrameChannel.close()if the writer has failed.booleanisClosed()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.voidwrite(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:WritableFrameChannelWrites a frame with an attached partition number. May throw an exception ifWritableFrameChannel.writabilityFuture()is unresolved.- Specified by:
writein interfaceWritableFrameChannel- Throws:
IOException
-
fail
public void fail(@Nullable Throwable cause) throws IOException
Description copied from interface:WritableFrameChannelCalled prior toWritableFrameChannel.close()if the writer has failed. Must be followed by a call toWritableFrameChannel.close().- Specified by:
failin interfaceWritableFrameChannel- Parameters:
cause- optional cause of failure. Used by the in-memory channelBlockingQueueFrameChannel.Writableto propagate exeptions to downstream processors. Most other channels ignore the provided cause.- Throws:
IOException
-
close
public void close() throws IOExceptionDescription copied from interface:WritableFrameChannelFinish 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceWritableFrameChannel- Throws:
IOException
-
isClosed
public boolean isClosed()
Description copied from interface:WritableFrameChannelWhetherWritableFrameChannel.close()has been called on this channel.- Specified by:
isClosedin interfaceWritableFrameChannel
-
writabilityFuture
public com.google.common.util.concurrent.ListenableFuture<?> writabilityFuture()
Description copied from interface:WritableFrameChannelReturns 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:
writabilityFuturein interfaceWritableFrameChannel
-
-