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.ByteBuffer
buffer
private static boolean
debugEnabled
private int
elementSize
private Mapper<E>
mapper
private int
maximumCapacity
private MpscChannelProducer<E>
producer
private int
requestedCapacity
-
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 void
checkByteBuffer()
private void
checkSufficientCapacity()
ChannelConsumer
consumer(ChannelReceiver<E> receiver)
private int
getMaximumCapacity(int requestedCapacity)
boolean
isEmpty()
int
maximumCapacity()
private MpscChannelConsumer<E>
newConsumer(java.lang.Object... args)
private MpscChannelProducer<E>
newProducer(java.lang.Class<E> type, java.lang.Object... args)
ChannelProducer<E>
producer()
int
requestedCapacity()
int
size()
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:Channel
Get the number of elements in the queue.
-
maximumCapacity
public int maximumCapacity()
- Specified by:
maximumCapacity
in interfaceChannel<E>
- Returns:
- the maximum number of elements that can fit in this channel.
-
requestedCapacity
public int requestedCapacity()
- Specified by:
requestedCapacity
in 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)
-
-