Permalink
Browse files

Merge remote branch 'mccv/master'

  • Loading branch information...
2 parents e12b68b + 68186c0 commit 0790c08929a85dccf9597b482fb5315de39a438a Robey Pointer committed Feb 8, 2011
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/main/scala/net/lag/smile/KetamaNodeLocator.scala
@@ -38,9 +38,14 @@ class KetamaNodeLocator(hasher: KeyHasher) extends NodeLocator {
}
def findNode(key: Array[Byte]): MemcacheConnection = synchronized {
- val hash = hasher.hashKey(key)
- val tail = continuum.from(hash)
- continuum(if (tail.isEmpty) continuum.firstKey else tail.firstKey)
+ if (continuum.isEmpty) {
+ // DOOM!
+ throw new NoSuchElementException()
+ } else {
+ val hash = hasher.hashKey(key)
+ val tail = continuum.from(hash)
+ continuum(if (tail.isEmpty) continuum.firstKey else tail.firstKey)
+ }
}
private def computeHash(key: String, alignment: Int) = {

0 comments on commit 0790c08

Please sign in to comment.