Package org.jctools.channels.spsc
Class SpscChannel<E>
java.lang.Object
org.jctools.channels.spsc.SpscChannel<E>
- All Implemented Interfaces:
Channel<E>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBuffer
private static final boolean
private final int
private final int
private final SpscChannelProducer
<E> private final int
-
Constructor Summary
ConstructorsConstructorDescriptionSpscChannel
(ByteBuffer buffer, int requestedCapacity, Class<E> type) This is to be used for an IPC queue with the direct buffer used being a memory mapped file. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private void
consumer
(ChannelReceiver<E> receiver) private int
getMaximumCapacity
(int requestedCapacity) boolean
isEmpty()
int
private SpscChannelConsumer
<E> newConsumer
(Object... args) private SpscChannelProducer
<E> newProducer
(Class<E> type, Object... args) producer()
int
int
size()
Get the number of elements in the queue.
-
Field Details
-
debugEnabled
private static final boolean debugEnabled- See Also:
-
elementSize
private final int elementSize -
mapper
-
buffer
-
maximumCapacity
private final int maximumCapacity -
requestedCapacity
private final int requestedCapacity -
producer
-
-
Constructor Details
-
SpscChannel
This is to be used for an IPC queue with the direct buffer used being a memory mapped file.- Parameters:
buffer
-requestedCapacity
-
-
-
Method Details
-
getMaximumCapacity
private int getMaximumCapacity(int requestedCapacity) -
checkByteBuffer
private void checkByteBuffer() -
checkSufficientCapacity
private void checkSufficientCapacity() -
consumer
-
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.
-
isEmpty
public boolean isEmpty() -
newProducer
-
newConsumer
-