com.twitter.common.zookeeper
Class Partitioner.Partition

java.lang.Object
  extended by com.twitter.common.zookeeper.Partitioner.Partition
All Implemented Interfaces:
Predicate<Long>, Group.Membership
Enclosing class:
Partitioner

public abstract static class Partitioner.Partition
extends Object
implements Predicate<Long>, Group.Membership

Represents a slice of a partition group. The partition is dynamic and will adjust its size as members join and leave its partition group.


Constructor Summary
Partitioner.Partition()
           
 
Method Summary
 boolean apply(Long input)
          Equivalent to isMember(long) for all non-null values; however incurs unboxing overhead.
abstract  int getNumPartitions()
          Gets number of members in the group at this time.
abstract  boolean isMember(long value)
          Returns true if the given value is a member of this partition at this time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.common.base.Predicate
equals
 
Methods inherited from interface com.twitter.common.zookeeper.Group.Membership
cancel, getGroupPath, getMemberId, getMemberPath, updateMemberData
 

Constructor Detail

Partitioner.Partition

public Partitioner.Partition()
Method Detail

isMember

public abstract boolean isMember(long value)
Returns true if the given value is a member of this partition at this time.


getNumPartitions

public abstract int getNumPartitions()
Gets number of members in the group at this time.

Returns:
number of members in the ZK group at this time.

apply

public boolean apply(@Nullable
                     Long input)
Equivalent to isMember(long) for all non-null values; however incurs unboxing overhead.

Specified by:
apply in interface Predicate<Long>