public class OutputChannel extends Object
WritableFrameChannel, which the
processor writes to, along with a supplier of a ReadableFrameChannel, which readers can read from.
At the time an instance of this class is created, the writable channel is already open, but the readable channel
has not yet been created. It is created upon the first call to getReadableChannel().| Modifier and Type | Method and Description |
|---|---|
MemoryAllocator |
getFrameMemoryAllocator()
Returns the memory allocator for the writable channel.
|
int |
getPartitionNumber() |
ReadableFrameChannel |
getReadableChannel()
Returns the readable channel of this pair.
|
WritableFrameChannel |
getWritableChannel()
Returns the writable channel of this pair.
|
OutputChannel |
mapWritableChannel(Function<WritableFrameChannel,WritableFrameChannel> mapFn) |
static OutputChannel |
nil(int partitionNumber)
Create a nil output channel, representing a processor that writes nothing.
|
static OutputChannel |
pair(WritableFrameChannel writableChannel,
MemoryAllocator frameMemoryAllocator,
Supplier<ReadableFrameChannel> readableChannelSupplier,
int partitionNumber)
Creates an output channel pair.
|
OutputChannel |
readOnly()
Returns a read-only version of this instance.
|
public static OutputChannel pair(WritableFrameChannel writableChannel, MemoryAllocator frameMemoryAllocator, Supplier<ReadableFrameChannel> readableChannelSupplier, int partitionNumber)
writableChannel - writable channel for producerframeMemoryAllocator - memory allocator for producer to use while writing frames to the channelreadableChannelSupplier - readable channel for consumer. May be called multiple times, so you should wrap this
in Suppliers.memoize(com.google.common.base.Supplier<T>) if needed.partitionNumber - partition number, if any; may be FrameWithPartition.NO_PARTITION if unknownpublic static OutputChannel nil(int partitionNumber)
public WritableFrameChannel getWritableChannel()
public MemoryAllocator getFrameMemoryAllocator()
public ReadableFrameChannel getReadableChannel()
public int getPartitionNumber()
public OutputChannel mapWritableChannel(Function<WritableFrameChannel,WritableFrameChannel> mapFn)
public OutputChannel readOnly()
getWritableChannel() nor
getFrameMemoryAllocator(), and therefore require substantially less memory.Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.