Package me.ahoo.cosid.zookeeper
Class ZookeeperIdSegmentDistributor
java.lang.Object
me.ahoo.cosid.segment.AbstractIdSegmentDistributor
me.ahoo.cosid.zookeeper.ZookeeperIdSegmentDistributor
- All Implemented Interfaces:
Grouped,IdSegmentDistributor
Zookeeper IdSegment Distributor.
-
Field Summary
Fields inherited from interface me.ahoo.cosid.segment.IdSegmentDistributor
DEFAULT_OFFSET, DEFAULT_SEGMENTS, DEFAULT_STEP -
Constructor Summary
ConstructorsConstructorDescriptionZookeeperIdSegmentDistributor(String namespace, String name, long offset, long step, org.apache.curator.framework.CuratorFramework curatorFramework, org.apache.curator.RetryPolicy retryPolicy) ZookeeperIdSegmentDistributor(String namespace, String name, long offset, long step, org.apache.curator.framework.CuratorFramework curatorFramework, org.apache.curator.RetryPolicy retryPolicy, CallTimeout callTimeout) Create a ZooKeeper segment distributor whoseAbstractIdSegmentDistributor.nextMaxId(long)gives up aftercallTimeout. -
Method Summary
Modifier and TypeMethodDescriptionprotected longdoNextMaxId(long step) Ask the store for the next max id,stepafter the previous one.Methods inherited from class me.ahoo.cosid.segment.AbstractIdSegmentDistributor
getLastMaxId, getName, getNamespace, getStep, nextMaxIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.ahoo.cosid.segment.IdSegmentDistributor
allowReset, getNamespacedName, getStep, nextIdSegment, nextIdSegment, nextIdSegment, nextIdSegmentChain, nextIdSegmentChain, nextMaxId
-
Constructor Details
-
ZookeeperIdSegmentDistributor
-
ZookeeperIdSegmentDistributor
public ZookeeperIdSegmentDistributor(String namespace, String name, long offset, long step, org.apache.curator.framework.CuratorFramework curatorFramework, org.apache.curator.RetryPolicy retryPolicy, CallTimeout callTimeout) Create a ZooKeeper segment distributor whoseAbstractIdSegmentDistributor.nextMaxId(long)gives up aftercallTimeout.ensureOffset()at startup is not bounded.
-
-
Method Details
-
doNextMaxId
protected long doNextMaxId(long step) Description copied from class:AbstractIdSegmentDistributorAsk the store for the next max id,stepafter the previous one.- Specified by:
doNextMaxIdin classAbstractIdSegmentDistributor- Parameters:
step- the step, already validated- Returns:
- the new max id
-