com.bigdata.btree
Class BTree.PartitionedCounter

java.lang.Object
  extended by com.bigdata.btree.BTree.PartitionedCounter
All Implemented Interfaces:
ICounter
Enclosing class:
BTree

public static class BTree.PartitionedCounter
extends Object
implements ICounter

Places the counter values into a namespace formed by the partition identifier. The partition identifier is found in the high int32 word and the counter value from the underlying BTree is found in the low int32 word.

Author:
Bryan Thompson

Constructor Summary
BTree.PartitionedCounter(int partitionId, ICounter src)
           
 
Method Summary
static long combine(int pid, int ctr)
          Combines the partition identifier and the local counter using the same logic as the BTree.PartitionedCounter.
 long get()
          The current value of the counter (initially zero).
static int getLocalCounter(long v)
          Return the local counter from the low word of a partitioned counter.
static int getPartitionId(long v)
          Return the partition identifier from the high word of a partitioned counter.
 long incrementAndGet()
          Increment the current value of the counter and then return its value (atomic).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BTree.PartitionedCounter

public BTree.PartitionedCounter(int partitionId,
                                ICounter src)
Method Detail

get

public long get()
Description copied from interface: ICounter
The current value of the counter (initially zero).

Specified by:
get in interface ICounter

incrementAndGet

public long incrementAndGet()
Description copied from interface: ICounter
Increment the current value of the counter and then return its value (atomic).

Specified by:
incrementAndGet in interface ICounter

getPartitionId

public static int getPartitionId(long v)
Return the partition identifier from the high word of a partitioned counter.

Parameters:
v - The partitioned counter.
Returns:
The high word.

getLocalCounter

public static int getLocalCounter(long v)
Return the local counter from the low word of a partitioned counter.

Parameters:
v - The partitioned counter.
Returns:
The low word.

combine

public static long combine(int pid,
                           int ctr)
Combines the partition identifier and the local counter using the same logic as the BTree.PartitionedCounter.

Parameters:
pid - The partition identifier.
ctr - The local counter.
Returns:
The long counter assembled from those values.


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.