org.terracotta.async.scatterpolicies
Class HashCodeScatterPolicy
java.lang.Object
org.terracotta.async.scatterpolicies.HashCodeScatterPolicy
- All Implemented Interfaces:
- ItemScatterPolicy<Object>
public class HashCodeScatterPolicy
- extends Object
- implements ItemScatterPolicy<Object>
ItemScatterPolicy that will select the bucket based on the Item's hash code.
This provides a Bucket (and worker Thread) to item affinity, so that an items with the same hash code will
always be processed by the same bucket.
|
Method Summary |
int |
selectBucket(int count,
Object item)
Returns a bucket index in the range 0 to (count - 1) to which an item should be assigned. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HashCodeScatterPolicy
public HashCodeScatterPolicy()
selectBucket
public int selectBucket(int count,
Object item)
- Description copied from interface:
ItemScatterPolicy
- Returns a bucket index in the range 0 to (count - 1) to which an item should be assigned.
- Specified by:
selectBucket in interface ItemScatterPolicy<Object>
- Parameters:
count - exclusive maximum indexitem - the item we are scattering across the buckets
- Returns:
- bucket index to use
Copyright © 2015 Terracotta, Inc.. All Rights Reserved.