org.apache.hadoop.hbase.regionserver
Class PriorityCompactionQueue
java.lang.Object
org.apache.hadoop.hbase.regionserver.PriorityCompactionQueue
- All Implemented Interfaces:
- Iterable<HRegion>, Collection<HRegion>, BlockingQueue<HRegion>, Queue<HRegion>
public class PriorityCompactionQueue
- extends Object
- implements BlockingQueue<HRegion>
This class delegates to the BlockingQueue but wraps all HRegions in
compaction requests that hold the priority and the date requested.
Implementation Note: With an elevation time of -1 there is the potential for
starvation of the lower priority compaction requests as long as there is a
constant stream of high priority requests.
Field Summary |
protected BlockingQueue<org.apache.hadoop.hbase.regionserver.PriorityCompactionQueue.CompactionRequest> |
queue
The actual blocking queue we delegate to |
Constructor Summary |
PriorityCompactionQueue()
Creates a new PriorityCompactionQueue with no priority elevation time |
Method Summary |
boolean |
add(HRegion e)
|
boolean |
add(HRegion e,
int p)
|
boolean |
addAll(Collection<? extends HRegion> c)
|
protected org.apache.hadoop.hbase.regionserver.PriorityCompactionQueue.CompactionRequest |
addToRegionsInQueue(HRegion r,
int p)
If the region is not already in the queue it will add it and return a
new compaction request object. |
void |
clear()
|
boolean |
contains(Object r)
|
boolean |
containsAll(Collection<?> c)
|
int |
drainTo(Collection<? super HRegion> c)
|
int |
drainTo(Collection<? super HRegion> c,
int maxElements)
|
HRegion |
element()
|
boolean |
isEmpty()
|
Iterator<HRegion> |
iterator()
|
boolean |
offer(HRegion e)
|
boolean |
offer(HRegion e,
int p)
|
boolean |
offer(HRegion e,
int p,
long timeout,
TimeUnit unit)
|
boolean |
offer(HRegion e,
long timeout,
TimeUnit unit)
|
HRegion |
peek()
|
HRegion |
poll()
|
HRegion |
poll(long timeout,
TimeUnit unit)
|
void |
put(HRegion e)
|
void |
put(HRegion e,
int p)
|
int |
remainingCapacity()
|
HRegion |
remove()
|
boolean |
remove(Object r)
|
boolean |
removeAll(Collection<?> c)
|
protected org.apache.hadoop.hbase.regionserver.PriorityCompactionQueue.CompactionRequest |
removeFromRegionsInQueue(org.apache.hadoop.hbase.regionserver.PriorityCompactionQueue.CompactionRequest remove)
Removes the request from the regions in queue |
boolean |
retainAll(Collection<?> c)
|
int |
size()
|
HRegion |
take()
|
Object[] |
toArray()
|
|
toArray(T[] a)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
queue
protected final BlockingQueue<org.apache.hadoop.hbase.regionserver.PriorityCompactionQueue.CompactionRequest> queue
- The actual blocking queue we delegate to
PriorityCompactionQueue
public PriorityCompactionQueue()
- Creates a new PriorityCompactionQueue with no priority elevation time
addToRegionsInQueue
protected org.apache.hadoop.hbase.regionserver.PriorityCompactionQueue.CompactionRequest addToRegionsInQueue(HRegion r,
int p)
- If the region is not already in the queue it will add it and return a
new compaction request object. If it is already present in the queue
then it will return null.
- Parameters:
p
- If null it will use the default priority
- Returns:
- returns a compaction request if it isn't already in the queue
removeFromRegionsInQueue
protected org.apache.hadoop.hbase.regionserver.PriorityCompactionQueue.CompactionRequest removeFromRegionsInQueue(org.apache.hadoop.hbase.regionserver.PriorityCompactionQueue.CompactionRequest remove)
- Removes the request from the regions in queue
- Parameters:
remove
-
add
public boolean add(HRegion e,
int p)
add
public boolean add(HRegion e)
- Specified by:
add
in interface Collection<HRegion>
- Specified by:
add
in interface BlockingQueue<HRegion>
- Specified by:
add
in interface Queue<HRegion>
offer
public boolean offer(HRegion e,
int p)
offer
public boolean offer(HRegion e)
- Specified by:
offer
in interface BlockingQueue<HRegion>
- Specified by:
offer
in interface Queue<HRegion>
put
public void put(HRegion e,
int p)
throws InterruptedException
- Throws:
InterruptedException
put
public void put(HRegion e)
throws InterruptedException
- Specified by:
put
in interface BlockingQueue<HRegion>
- Throws:
InterruptedException
offer
public boolean offer(HRegion e,
int p,
long timeout,
TimeUnit unit)
throws InterruptedException
- Throws:
InterruptedException
offer
public boolean offer(HRegion e,
long timeout,
TimeUnit unit)
throws InterruptedException
- Specified by:
offer
in interface BlockingQueue<HRegion>
- Throws:
InterruptedException
take
public HRegion take()
throws InterruptedException
- Specified by:
take
in interface BlockingQueue<HRegion>
- Throws:
InterruptedException
poll
public HRegion poll(long timeout,
TimeUnit unit)
throws InterruptedException
- Specified by:
poll
in interface BlockingQueue<HRegion>
- Throws:
InterruptedException
remove
public boolean remove(Object r)
- Specified by:
remove
in interface Collection<HRegion>
- Specified by:
remove
in interface BlockingQueue<HRegion>
remove
public HRegion remove()
- Specified by:
remove
in interface Queue<HRegion>
poll
public HRegion poll()
- Specified by:
poll
in interface Queue<HRegion>
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacity
in interface BlockingQueue<HRegion>
contains
public boolean contains(Object r)
- Specified by:
contains
in interface Collection<HRegion>
- Specified by:
contains
in interface BlockingQueue<HRegion>
element
public HRegion element()
- Specified by:
element
in interface Queue<HRegion>
peek
public HRegion peek()
- Specified by:
peek
in interface Queue<HRegion>
size
public int size()
- Specified by:
size
in interface Collection<HRegion>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface Collection<HRegion>
clear
public void clear()
- Specified by:
clear
in interface Collection<HRegion>
iterator
public Iterator<HRegion> iterator()
- Specified by:
iterator
in interface Iterable<HRegion>
- Specified by:
iterator
in interface Collection<HRegion>
toArray
public Object[] toArray()
- Specified by:
toArray
in interface Collection<HRegion>
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interface Collection<HRegion>
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interface Collection<HRegion>
addAll
public boolean addAll(Collection<? extends HRegion> c)
- Specified by:
addAll
in interface Collection<HRegion>
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interface Collection<HRegion>
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interface Collection<HRegion>
drainTo
public int drainTo(Collection<? super HRegion> c)
- Specified by:
drainTo
in interface BlockingQueue<HRegion>
drainTo
public int drainTo(Collection<? super HRegion> c,
int maxElements)
- Specified by:
drainTo
in interface BlockingQueue<HRegion>
Copyright © 2011 The Apache Software Foundation. All Rights Reserved.