com.netflix.curator.framework.recipes.atomic
Class CachedAtomicLong

java.lang.Object
  extended by com.netflix.curator.framework.recipes.atomic.CachedAtomicLong

public class CachedAtomicLong
extends Object

Uses an DistributedAtomicNumber and allocates values in chunks for better performance


Constructor Summary
CachedAtomicLong(DistributedAtomicLong number, int cacheFactor)
           
 
Method Summary
 AtomicValue<Long> next()
          Returns the next value (incrementing by 1).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedAtomicLong

public CachedAtomicLong(DistributedAtomicLong number,
                        int cacheFactor)
Parameters:
number - the number to use
cacheFactor - the number of values to allocate at a time
Method Detail

next

public AtomicValue<Long> next()
                       throws Exception
Returns the next value (incrementing by 1). If a new chunk of numbers is needed, it is requested from the number

Returns:
next increment
Throws:
Exception - errors


Copyright © 2012. All Rights Reserved.