minor edits

This commit is contained in:
Jonas Bonér 2010-09-06 14:03:49 +02:00
parent 8e1c3ace5c
commit 403dc2bf1c
2 changed files with 15 additions and 3 deletions

View file

@ -35,6 +35,11 @@ trait Cluster {
* The order of application is undefined and may vary
*/
def foreach(f: (RemoteAddress) => Unit): Unit
/**
* Returns all the endpoints in the cluster.
*/
def endpoints: Array[RemoteAddress]
}
/**
@ -196,6 +201,11 @@ abstract class BasicClusterActor extends ClusterActor with Logging {
* Applies the given function to all remote addresses known
*/
def foreach(f: (RemoteAddress) => Unit): Unit = remotes.valuesIterator.toList.flatMap(_.endpoints).foreach(f)
/**
* Returns all the endpoints in the cluster.
*/
def endpoints: Array[RemoteAddress] = remotes.toArray.asInstanceOf[Array[RemoteAddress]]
}
/**
@ -211,7 +221,7 @@ object Cluster extends Cluster with Logging {
lazy val DEFAULT_CLUSTER_ACTOR_CLASS_NAME = classOf[JGroupsClusterActor].getName
@volatile private[remote] var clusterActorRef: Option[ActorRef] = None
@volatile private[akka] var classLoader : Option[ClassLoader] = Some(getClass.getClassLoader)
@volatile private[akka] var classLoader: Option[ClassLoader] = Some(getClass.getClassLoader)
private[remote] def createClusterActor(): Option[ActorRef] = {
val name = config.getString("akka.remote.cluster.actor", DEFAULT_CLUSTER_ACTOR_CLASS_NAME)
@ -233,7 +243,7 @@ object Cluster extends Cluster with Logging {
RestartStrategy(OneForOne, 5, 1000, List(classOf[Exception])),
Supervise(actor, LifeCycle(Permanent)) :: Nil)))
private[this] def clusterActor = if(clusterActorRef.isEmpty) None else Some(clusterActorRef.get.actor.asInstanceOf[ClusterActor])
private[this] def clusterActor = if (clusterActorRef.isEmpty) None else Some(clusterActorRef.get.actor.asInstanceOf[ClusterActor])
def name = clusterActor.map(_.name).getOrElse("No cluster")
@ -257,6 +267,8 @@ object Cluster extends Cluster with Logging {
def foreach(f: (RemoteAddress) => Unit): Unit = clusterActor.foreach(_.foreach(f))
def endpoints: Array[RemoteAddress] = clusterActor.end
def start(): Unit = start(None)
def start(serializerClassLoader: Option[ClassLoader]): Unit = synchronized {

View file

@ -67,7 +67,7 @@ trait SerializerBasedActorFormat[T <: Actor] extends Format[T] {
}
/**
* Module for local actor serialization
* Module for local actor serialization.
*/
object ActorSerialization {