Class MpscChannel<E>

  • All Implemented Interfaces:
    Channel<E>

    public final class MpscChannel<E>
    extends Object
    implements Channel<E>
    • Constructor Detail

      • MpscChannel

        public MpscChannel​(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.
        Parameters:
        buffer -
        requestedCapacity -
    • Method Detail

      • consumer

        public ChannelConsumer consumer​(ChannelReceiver<E> receiver)
        Specified by:
        consumer in interface Channel<E>
        Parameters:
        receiver - the accept function for this consumer
        Returns:
        a consumer instance to be used for this particular thread.
      • producer

        public ChannelProducer<E> producer()
        Specified by:
        producer in interface Channel<E>
        Returns:
        a producer instance to be used for this particular thread.
      • size

        public int size()
        Description copied from interface: Channel
        Get the number of elements in the queue.
        Specified by:
        size in interface Channel<E>
        Returns:
        the number of elements in the queue.
      • maximumCapacity

        public int maximumCapacity()
        Specified by:
        maximumCapacity in interface Channel<E>
        Returns:
        the maximum number of elements that can fit in this channel.
      • requestedCapacity

        public int requestedCapacity()
        Specified by:
        requestedCapacity in interface Channel<E>
        Returns:
        The requested maximum number of elements that can fit in this channel.
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface Channel<E>