Package org.infinispan.persistence.sifs
Class IndexQueue
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<org.infinispan.persistence.sifs.IndexRequest>
-
- org.infinispan.persistence.sifs.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 Summary
Constructors Constructor Description IndexQueue(int segments, int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
drainTo(Collection<? super org.infinispan.persistence.sifs.IndexRequest> c)
int
drainTo(Collection<? super org.infinispan.persistence.sifs.IndexRequest> c, int maxElements)
Iterator<org.infinispan.persistence.sifs.IndexRequest>
iterator()
boolean
offer(org.infinispan.persistence.sifs.IndexRequest indexRequest)
boolean
offer(org.infinispan.persistence.sifs.IndexRequest indexRequest, long timeout, TimeUnit unit)
org.infinispan.persistence.sifs.IndexRequest
peek()
org.infinispan.persistence.sifs.IndexRequest
poll()
org.infinispan.persistence.sifs.IndexRequest
poll(long timeout, TimeUnit unit)
void
put(org.infinispan.persistence.sifs.IndexRequest indexRequest)
int
remainingCapacity()
int
size()
BlockingQueue<org.infinispan.persistence.sifs.IndexRequest>
subQueue(int id)
org.infinispan.persistence.sifs.IndexRequest
take()
-
-
-
Method Detail
-
iterator
public Iterator<org.infinispan.persistence.sifs.IndexRequest> iterator()
-
size
public int size()
-
put
public void put(org.infinispan.persistence.sifs.IndexRequest indexRequest) throws InterruptedException
- Throws:
InterruptedException
-
offer
public boolean offer(org.infinispan.persistence.sifs.IndexRequest indexRequest, long timeout, TimeUnit unit) throws InterruptedException
- Throws:
InterruptedException
-
take
public org.infinispan.persistence.sifs.IndexRequest take() throws InterruptedException
- Throws:
InterruptedException
-
poll
public org.infinispan.persistence.sifs.IndexRequest poll(long timeout, TimeUnit unit) throws InterruptedException
- Throws:
InterruptedException
-
remainingCapacity
public int remainingCapacity()
-
drainTo
public int drainTo(Collection<? super org.infinispan.persistence.sifs.IndexRequest> c)
-
drainTo
public int drainTo(Collection<? super org.infinispan.persistence.sifs.IndexRequest> c, int maxElements)
-
offer
public boolean offer(org.infinispan.persistence.sifs.IndexRequest indexRequest)
-
poll
public org.infinispan.persistence.sifs.IndexRequest poll()
-
peek
public org.infinispan.persistence.sifs.IndexRequest peek()
-
subQueue
public BlockingQueue<org.infinispan.persistence.sifs.IndexRequest> subQueue(int id)
-
-