|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.netflix.curator.framework.recipes.queue.QueueSharder<U,T>
public class QueueSharder<U,T extends QueueBase<U>>
A utility for shard a distributed queue.
Due to limitations in ZooKeeper's transport layer, a single queue will break if it has more than 10K-ish items in it. This class provides a facade over multiple distributed queues. It monitors the queues and if any one of them goes over a threshold, a new queue is added. Puts are distributed amongst the queues.
NOTE: item ordering is maintained within each managed queue but cannot be maintained across queues. i.e. items might get consumed out of order if they are in different managed queues.
| Constructor Summary | |
|---|---|
QueueSharder(com.netflix.curator.framework.CuratorFramework client,
QueueAllocator<U,T> queueAllocator,
java.lang.String queuePath,
java.lang.String leaderPath,
QueueSharderPolicies policies)
|
|
| Method Summary | |
|---|---|
void |
close()
|
T |
getQueue()
Return one of the managed queues - the selection method cannot be relied on. |
java.util.Collection<java.lang.String> |
getQueuePaths()
Return the current set of shard paths |
int |
getShardQty()
Return the current number of mananged queues |
void |
start()
The sharder must be started |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public QueueSharder(com.netflix.curator.framework.CuratorFramework client,
QueueAllocator<U,T> queueAllocator,
java.lang.String queuePath,
java.lang.String leaderPath,
QueueSharderPolicies policies)
client - clientqueueAllocator - allocator for new queuesqueuePath - path for the queuesleaderPath - path for the leader that monitors queue sizes (must be different than queuePath)policies - sharding policies| Method Detail |
|---|
public void start()
throws java.lang.Exception
java.lang.Exception - errorspublic void close()
close in interface java.io.Closeablepublic T getQueue()
public int getShardQty()
public java.util.Collection<java.lang.String> getQueuePaths()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||