Fixed handling of passive connections in the failureinjector and remoting

This commit is contained in:
Endre Sándor Varga 2012-12-12 12:29:36 +01:00
parent a7b78bf78b
commit f1177464ad
4 changed files with 23 additions and 21 deletions

View file

@ -279,9 +279,12 @@ private[remote] object EndpointManager {
endpoint
}
// FIXME: Temporary hack to verify the bug
def isPassive(endpoint: ActorRef): Boolean = addressToPassive.contains(endpointToAddress(endpoint))
def markFailed(endpoint: ActorRef, timeOfFailure: Long): Unit = {
addressToEndpointAndPolicy += endpointToAddress(endpoint) -> Gated(timeOfFailure)
endpointToAddress = endpointToAddress - endpoint
if (!isPassive(endpoint)) endpointToAddress = endpointToAddress - endpoint
}
def markQuarantine(address: Address, reason: Throwable): Unit =
@ -289,12 +292,13 @@ private[remote] object EndpointManager {
def removeIfNotGated(endpoint: ActorRef): Unit = {
endpointToAddress.get(endpoint) foreach { address
addressToEndpointAndPolicy.get(address) foreach {
case Pass(_)
addressToEndpointAndPolicy = addressToEndpointAndPolicy - address
endpointToAddress = endpointToAddress - endpoint
case _
addressToEndpointAndPolicy.get(address) foreach {
case Pass(_) addressToEndpointAndPolicy = addressToEndpointAndPolicy - address
case _
}
endpointToAddress = endpointToAddress - endpoint
addressToPassive = addressToPassive - address
}
}
}
@ -472,6 +476,8 @@ private[remote] class EndpointManager(conf: Config, log: LoggingAdapter) extends
.withDispatcher("akka.remoting.writer-dispatcher"),
"endpointWriter-" + URLEncoder.encode(remoteAddress.toString, "utf-8") + "-" + endpointId.next()))
context.watch(endpoint)
}
private def retryGateOpen(timeOfFailure: Long): Boolean = (timeOfFailure + settings.RetryGateClosedFor) < System.nanoTime()