Added method to ClusterNode to check if an actor is checked out on a specific (other) node, also added 'start' and 'boot' methods.

Signed-off-by: Jonas Bonér <jonas@jonasboner.com>
This commit is contained in:
Jonas Bonér 2011-08-24 21:48:47 +02:00
parent aeb8178007
commit f9e82eaee5
2 changed files with 18 additions and 4 deletions

View file

@ -129,6 +129,8 @@ trait ClusterNode {
def remoteServerAddress: InetSocketAddress def remoteServerAddress: InetSocketAddress
def start()
def shutdown() def shutdown()
def isShutdown: Boolean def isShutdown: Boolean
@ -298,6 +300,11 @@ trait ClusterNode {
*/ */
def isInUseOnNode(actorAddress: String): Boolean def isInUseOnNode(actorAddress: String): Boolean
/**
* Is the actor with uuid in use or not?
*/
def isInUseOnNode(actorAddress: String, nodeName: String): Boolean
/** /**
* Is the actor with uuid in use or not? * Is the actor with uuid in use or not?
*/ */
@ -465,7 +472,7 @@ trait ClusterNode {
*/ */
private[cluster] def uuidsForActorsInUseOnNode(nodeName: String): Array[UUID] private[cluster] def uuidsForActorsInUseOnNode(nodeName: String): Array[UUID]
private[cluster] def initializeNode() private[cluster] def boot()
private[cluster] def publish(change: ChangeNotification) private[cluster] def publish(change: ChangeNotification)

View file

@ -378,13 +378,13 @@ class DefaultClusterNode private[akka] (
if (enableJMX) createMBean if (enableJMX) createMBean
initializeNode() boot()
// ======================================= // =======================================
// Node // Node
// ======================================= // =======================================
private[cluster] def initializeNode() { private[cluster] def boot() {
EventHandler.info(this, EventHandler.info(this,
("\nCreating cluster node with" + ("\nCreating cluster node with" +
"\n\tcluster name = [%s]" + "\n\tcluster name = [%s]" +
@ -404,6 +404,8 @@ class DefaultClusterNode private[akka] (
def isShutdown = isShutdownFlag.get def isShutdown = isShutdownFlag.get
def start() {}
def shutdown() { def shutdown() {
isShutdownFlag.set(true) isShutdownFlag.set(true)
@ -715,6 +717,11 @@ class DefaultClusterNode private[akka] (
*/ */
def isInUseOnNode(actorAddress: String, node: NodeAddress): Boolean = zkClient.exists(actorAddressToNodesPathFor(actorAddress, node.nodeName)) def isInUseOnNode(actorAddress: String, node: NodeAddress): Boolean = zkClient.exists(actorAddressToNodesPathFor(actorAddress, node.nodeName))
/**
* Is the actor with uuid in use or not?
*/
def isInUseOnNode(actorAddress: String, nodeName: String): Boolean = zkClient.exists(actorAddressToNodesPathFor(actorAddress, nodeName))
/** /**
* Checks out an actor for use on this node, e.g. checked out as a 'LocalActorRef' but it makes it available * Checks out an actor for use on this node, e.g. checked out as a 'LocalActorRef' but it makes it available
* for remote access through lookup by its UUID. * for remote access through lookup by its UUID.
@ -1665,7 +1672,7 @@ class StateListener(self: ClusterNode) extends IZkStateListener {
*/ */
def handleNewSession() { def handleNewSession() {
EventHandler.debug(this, "Session expired re-initializing node [%s]".format(self.nodeAddress)) EventHandler.debug(this, "Session expired re-initializing node [%s]".format(self.nodeAddress))
self.initializeNode() self.boot()
self.publish(NewSession) self.publish(NewSession)
} }
} }