@Test public void stringHashing() { final String hashValue = "keystring"; ShardLocator<String> shardLocator1 = new ShardLocator<>(STRING_FUNNEL, 100 ); int index1 = shardLocator1.getBucket( hashValue ); ShardLocator<String> shardLocator2 = new ShardLocator<>( STRING_FUNNEL, 100 ); int index2 = shardLocator2.getBucket( hashValue ); assertEquals( "Same index expected", index1, index2 ); }
public int getBucket( T value ) { final HashCode hashCode = HASHER.hashObject( value, funnel ); int owningIndex = Hashing.consistentHash( hashCode, totalBuckets ); return owningIndex; }
ShardLocator { public int getBucket( T value ) { final HashCode hashCode = HASHER.hashObject( value, funnel ); int owningIndex = Hashing.consistentHash( hashCode, totalBuckets ); return owningIndex; } }
ShardLocator { public int getBucket( T value ) { final HashCode hashCode = HASHER.hashObject( value, funnel ); int owningIndex = Hashing.consistentHash( hashCode, totalBuckets ); return owningIndex; } ShardLocator( final Funnel<T> funnel, final int totalBuckets ); }
ShardLocator { public int getBucket( T value ) { final HashCode hashCode = HASHER.hashObject( value, funnel ); int owningIndex = Hashing.consistentHash( hashCode, totalBuckets ); return owningIndex; } ShardLocator( final Funnel<T> funnel, final int totalBuckets ); int getBucket( T value ); }
ShardLocator { public int getBucket( T value ) { final HashCode hashCode = HASHER.hashObject( value, funnel ); int owningIndex = Hashing.consistentHash( hashCode, totalBuckets ); return owningIndex; } ShardLocator( final Funnel<T> funnel, final int totalBuckets ); int getBucket( T value );  }