Added lockless FailureDetector.putIfAbsent(connection).

Signed-off-by: Jonas Bonér <jonas@jonasboner.com>
This commit is contained in:
Jonas Bonér 2011-09-19 14:40:12 +02:00
parent cd4a3c3a1a
commit e70ab6d12c
3 changed files with 66 additions and 55 deletions

View file

@ -103,8 +103,6 @@ class RemoveConnectionOnFirstFailureLocalFailureDetector extends FailureDetector
state.get.iterable foreach (_.stop())
}
def failOver(from: InetSocketAddress, to: InetSocketAddress) {} // do nothing here
@tailrec
final def remove(ref: ActorRef) = {
val oldState = state.get
@ -120,6 +118,12 @@ class RemoveConnectionOnFirstFailureLocalFailureDetector extends FailureDetector
if (!state.compareAndSet(oldState, newState)) remove(ref)
}
}
def failOver(from: InetSocketAddress, to: InetSocketAddress) {} // do nothing here
def putIfAbsent(address: InetSocketAddress, newConnectionFactory: () ActorRef): ActorRef = {
throw new UnsupportedOperationException("Not supported")
}
}
/**