Package org.jctools.channels.mpsc
Class MpscChannel<E>
- java.lang.Object
-
- org.jctools.channels.mpsc.MpscChannel<E>
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteBufferbufferprivate static booleandebugEnabledprivate intelementSizeprivate Mapper<E>mapperprivate intmaximumCapacityprivate MpscChannelProducer<E>producerprivate intrequestedCapacity
-
Constructor Summary
Constructors Constructor Description MpscChannel(java.nio.ByteBuffer buffer, int requestedCapacity, java.lang.Class<E> type)This is to be used for an IPC queue with the direct buffer used being a memory mapped file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckByteBuffer()private voidcheckSufficientCapacity()ChannelConsumerconsumer(ChannelReceiver<E> receiver)private intgetMaximumCapacity(int requestedCapacity)booleanisEmpty()intmaximumCapacity()private MpscChannelConsumer<E>newConsumer(java.lang.Object... args)private MpscChannelProducer<E>newProducer(java.lang.Class<E> type, java.lang.Object... args)ChannelProducer<E>producer()intrequestedCapacity()intsize()Get the number of elements in the queue.
-
-
-
Field Detail
-
debugEnabled
private static final boolean debugEnabled
- See Also:
- Constant Field Values
-
elementSize
private final int elementSize
-
buffer
private final java.nio.ByteBuffer buffer
-
maximumCapacity
private final int maximumCapacity
-
requestedCapacity
private final int requestedCapacity
-
producer
private final MpscChannelProducer<E> producer
-
-
Constructor Detail
-
MpscChannel
public MpscChannel(java.nio.ByteBuffer buffer, int requestedCapacity, java.lang.Class<E> type)This is to be used for an IPC queue with the direct buffer used being a memory mapped file.- Parameters:
buffer-requestedCapacity-
-
-
Method Detail
-
getMaximumCapacity
private int getMaximumCapacity(int requestedCapacity)
-
checkByteBuffer
private void checkByteBuffer()
-
checkSufficientCapacity
private void checkSufficientCapacity()
-
consumer
public ChannelConsumer consumer(ChannelReceiver<E> receiver)
-
producer
public ChannelProducer<E> producer()
-
size
public int size()
Description copied from interface:ChannelGet the number of elements in the queue.
-
maximumCapacity
public int maximumCapacity()
- Specified by:
maximumCapacityin interfaceChannel<E>- Returns:
- the maximum number of elements that can fit in this channel.
-
requestedCapacity
public int requestedCapacity()
- Specified by:
requestedCapacityin interfaceChannel<E>- Returns:
- The requested maximum number of elements that can fit in this channel.
-
newProducer
private MpscChannelProducer<E> newProducer(java.lang.Class<E> type, java.lang.Object... args)
-
newConsumer
private MpscChannelConsumer<E> newConsumer(java.lang.Object... args)
-
-