Class IndexQueue

  • All Implemented Interfaces:
    Iterable<org.infinispan.persistence.sifs.IndexRequest>, Collection<org.infinispan.persistence.sifs.IndexRequest>, BlockingQueue<org.infinispan.persistence.sifs.IndexRequest>, Queue<org.infinispan.persistence.sifs.IndexRequest>

    public class IndexQueue
    extends AbstractQueue<org.infinispan.persistence.sifs.IndexRequest>
    implements BlockingQueue<org.infinispan.persistence.sifs.IndexRequest>
    Splits the requests into several subqueues according to request.key.hashCode(). If the request has no key, inserts countdown into the request and puts it into all subqueues - the thread that retrieves such element should call countDown() and upon true handle the request (this preserves the FIFO ordering).
    Author:
    Radim Vansa <rvansa@redhat.coPausem>
    • Constructor Detail

      • IndexQueue

        public IndexQueue​(int segments,
                          int capacity)
    • Method Detail

      • iterator

        public Iterator<org.infinispan.persistence.sifs.IndexRequest> iterator()
        Specified by:
        iterator in interface Collection<org.infinispan.persistence.sifs.IndexRequest>
        Specified by:
        iterator in interface Iterable<org.infinispan.persistence.sifs.IndexRequest>
        Specified by:
        iterator in class AbstractCollection<org.infinispan.persistence.sifs.IndexRequest>
      • size

        public int size()
        Specified by:
        size in interface Collection<org.infinispan.persistence.sifs.IndexRequest>
        Specified by:
        size in class AbstractCollection<org.infinispan.persistence.sifs.IndexRequest>
      • remainingCapacity

        public int remainingCapacity()
        Specified by:
        remainingCapacity in interface BlockingQueue<org.infinispan.persistence.sifs.IndexRequest>
      • drainTo

        public int drainTo​(Collection<? super org.infinispan.persistence.sifs.IndexRequest> c)
        Specified by:
        drainTo in interface BlockingQueue<org.infinispan.persistence.sifs.IndexRequest>
      • drainTo

        public int drainTo​(Collection<? super org.infinispan.persistence.sifs.IndexRequest> c,
                           int maxElements)
        Specified by:
        drainTo in interface BlockingQueue<org.infinispan.persistence.sifs.IndexRequest>
      • offer

        public boolean offer​(org.infinispan.persistence.sifs.IndexRequest indexRequest)
        Specified by:
        offer in interface BlockingQueue<org.infinispan.persistence.sifs.IndexRequest>
        Specified by:
        offer in interface Queue<org.infinispan.persistence.sifs.IndexRequest>
      • poll

        public org.infinispan.persistence.sifs.IndexRequest poll()
        Specified by:
        poll in interface Queue<org.infinispan.persistence.sifs.IndexRequest>
      • peek

        public org.infinispan.persistence.sifs.IndexRequest peek()
        Specified by:
        peek in interface Queue<org.infinispan.persistence.sifs.IndexRequest>
      • subQueue

        public BlockingQueue<org.infinispan.persistence.sifs.IndexRequest> subQueue​(int id)