ticket #992: misc fixes for transaction log, processed review comments

This commit is contained in:
Peter Veentjer 2011-08-08 20:57:01 +03:00
parent 403f425283
commit c8e938a44c
2 changed files with 55 additions and 53 deletions

View file

@ -1800,7 +1800,9 @@ class RemoteClusterDaemon(cluster: ClusterNode) extends Actor {
def handleRelease(message: ClusterProtocol.RemoteDaemonMessageProtocol) { def handleRelease(message: ClusterProtocol.RemoteDaemonMessageProtocol) {
if (message.hasActorUuid) { if (message.hasActorUuid) {
cluster.actorAddressForUuid(uuidProtocolToUuid(message.getActorUuid)) foreach cluster.release(_) cluster.actorAddressForUuid(uuidProtocolToUuid(message.getActorUuid)) foreach { address
cluster.release(address)
}
} else if (message.hasActorAddress) { } else if (message.hasActorAddress) {
cluster release message.getActorAddress cluster release message.getActorAddress
} else { } else {
@ -1909,7 +1911,7 @@ class RemoteClusterDaemon(cluster: ClusterNode) extends Actor {
} }
self.reply(Success) self.reply(Success)
} catch { } catch {
case error:Throwable case error: Throwable
self.reply(Failure(error)) self.reply(Failure(error))
throw error throw error
} }

View file

@ -41,73 +41,73 @@ class ClusterActorRefCleanupMultiJvmNode1 extends MasterClusterTestNode {
"ClusterActorRef" must { "ClusterActorRef" must {
"cleanup itself" in { "cleanup itself" in {
node.start node.start
barrier("awaitStarted", NrOfNodes).await() barrier("awaitStarted", NrOfNodes).await()
val ref = Actor.actorOf[ClusterActorRefCleanupMultiJvmSpec.TestActor]("service-test") val ref = Actor.actorOf[ClusterActorRefCleanupMultiJvmSpec.TestActor]("service-test")
ref.isInstanceOf[ClusterActorRef] must be(true) ref.isInstanceOf[ClusterActorRef] must be(true)
val clusteredRef = ref.asInstanceOf[ClusterActorRef] val clusteredRef = ref.asInstanceOf[ClusterActorRef]
//verify that all remote actors are there. //verify that all remote actors are there.
clusteredRef.connections.size must be(2) clusteredRef.connections.size must be(2)
// ignore exceptions from killing nodes // ignore exceptions from killing nodes
val ignoreExceptions = Seq( val ignoreExceptions = Seq(
EventFilter[ClosedChannelException], EventFilter[ClosedChannelException],
EventFilter[NotYetConnectedException], EventFilter[NotYetConnectedException],
EventFilter[RoutingException], EventFilter[RoutingException],
EventFilter[ConnectException]) EventFilter[ConnectException])
EventHandler.notify(TestEvent.Mute(ignoreExceptions)) EventHandler.notify(TestEvent.Mute(ignoreExceptions))
//let one of the actors die. //let one of the actors die.
clusteredRef ! "Die" clusteredRef ! "Die"
//just some waiting to make sure that the node has died. //just some waiting to make sure that the node has died.
Thread.sleep(5000) Thread.sleep(5000)
//send some request, this should trigger the cleanup //send some request, this should trigger the cleanup
try { try {
clusteredRef ! "hello"
clusteredRef ! "hello"
} catch {
case e: ClosedChannelException
case e: NotYetConnectedException
case e: RoutingException
}
//since the call to the node failed, the node must have been removed from the list.
clusteredRef.connections.size must be(1)
//send a message to this node,
clusteredRef ! "hello" clusteredRef ! "hello"
clusteredRef ! "hello"
} catch {
case e: ClosedChannelException
case e: NotYetConnectedException
case e: RoutingException
}
//now kill another node //since the call to the node failed, the node must have been removed from the list.
clusteredRef ! "Die" clusteredRef.connections.size must be(1)
//just some waiting to make sure that the node has died. //send a message to this node,
Thread.sleep(5000) clusteredRef ! "hello"
//trigger the cleanup. //now kill another node
try { clusteredRef ! "Die"
clusteredRef ! "hello"
} catch {
case e: ClosedChannelException
case e: NotYetConnectedException
case e: RoutingException
}
//now there must not be any remaining connections after the dead of the last actor. //just some waiting to make sure that the node has died.
clusteredRef.connections.size must be(0) Thread.sleep(5000)
//and lets make sure we now get the correct exception if we try to use the ref. //trigger the cleanup.
intercept[RoutingException] { try {
clusteredRef ! "Hello" clusteredRef ! "hello"
} } catch {
case e: ClosedChannelException
case e: NotYetConnectedException
case e: RoutingException
}
node.shutdown() //now there must not be any remaining connections after the dead of the last actor.
clusteredRef.connections.size must be(0)
//and lets make sure we now get the correct exception if we try to use the ref.
intercept[RoutingException] {
clusteredRef ! "Hello"
}
node.shutdown()
} }
} }
} }