Added 'akka.cluster' package object with implicit conversion which creates an augmented 'ActorSystem' with a method 'def node: Node'.
Signed-off-by: Jonas Bonér <jonas@jonasboner.com>
This commit is contained in:
parent
517981101f
commit
96ed8bdccf
5 changed files with 25 additions and 7 deletions
|
|
@ -170,8 +170,6 @@ final class ClusterCommandDaemon(system: ActorSystem, node: Node) extends Actor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME create package object with implicit conversion that enables: system.node
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pooled and routed wit N number of configurable instances.
|
* Pooled and routed wit N number of configurable instances.
|
||||||
* Concurrent access to Node.
|
* Concurrent access to Node.
|
||||||
|
|
|
||||||
20
akka-cluster/src/main/scala/akka/package.scala
Normal file
20
akka-cluster/src/main/scala/akka/package.scala
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
package akka
|
||||||
|
|
||||||
|
import akka.actor.ActorSystem
|
||||||
|
|
||||||
|
package object cluster {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implicitly creates an augmented [[akka.actor.ActorSystem]] with a method {{{def node: Node}}}.
|
||||||
|
*
|
||||||
|
* @param system
|
||||||
|
* @return An augmented [[akka.actor.ActorSystem]] with a method {{{def node: Node}}}.
|
||||||
|
*/
|
||||||
|
implicit def actorSystemWithNodeAccessor(system: ActorSystem) = new {
|
||||||
|
val node = NodeExtension(system)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,7 @@ import akka.testkit.AkkaSpec
|
||||||
import akka.actor.Address
|
import akka.actor.Address
|
||||||
|
|
||||||
class AccrualFailureDetectorSpec extends AkkaSpec("""
|
class AccrualFailureDetectorSpec extends AkkaSpec("""
|
||||||
akka.loglevel = "DEBUG"
|
akka.loglevel = "INFO"
|
||||||
""") {
|
""") {
|
||||||
|
|
||||||
"An AccrualFailureDetector" must {
|
"An AccrualFailureDetector" must {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import java.net.InetSocketAddress
|
||||||
|
|
||||||
class LeaderElectionSpec extends AkkaSpec("""
|
class LeaderElectionSpec extends AkkaSpec("""
|
||||||
akka {
|
akka {
|
||||||
loglevel = "DEBUG"
|
loglevel = "INFO"
|
||||||
actor.debug.lifecycle = on
|
actor.debug.lifecycle = on
|
||||||
actor.debug.autoreceive = on
|
actor.debug.autoreceive = on
|
||||||
cluster.failure-detector.threshold = 3
|
cluster.failure-detector.threshold = 3
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class NodeMembershipSpec extends AkkaSpec("""
|
||||||
.withFallback(system.settings.config))
|
.withFallback(system.settings.config))
|
||||||
.asInstanceOf[ActorSystemImpl]
|
.asInstanceOf[ActorSystemImpl]
|
||||||
val remote0 = system0.provider.asInstanceOf[RemoteActorRefProvider]
|
val remote0 = system0.provider.asInstanceOf[RemoteActorRefProvider]
|
||||||
node0 = new Node(system0)
|
node0 = system0.node
|
||||||
|
|
||||||
// ======= NODE 1 ========
|
// ======= NODE 1 ========
|
||||||
system1 = ActorSystem("system1", ConfigFactory
|
system1 = ActorSystem("system1", ConfigFactory
|
||||||
|
|
@ -60,7 +60,7 @@ class NodeMembershipSpec extends AkkaSpec("""
|
||||||
.withFallback(system.settings.config))
|
.withFallback(system.settings.config))
|
||||||
.asInstanceOf[ActorSystemImpl]
|
.asInstanceOf[ActorSystemImpl]
|
||||||
val remote1 = system1.provider.asInstanceOf[RemoteActorRefProvider]
|
val remote1 = system1.provider.asInstanceOf[RemoteActorRefProvider]
|
||||||
node1 = new Node(system1)
|
node1 = system1.node
|
||||||
|
|
||||||
Thread.sleep(10.seconds.dilated.toMillis)
|
Thread.sleep(10.seconds.dilated.toMillis)
|
||||||
|
|
||||||
|
|
@ -99,7 +99,7 @@ class NodeMembershipSpec extends AkkaSpec("""
|
||||||
.withFallback(system.settings.config))
|
.withFallback(system.settings.config))
|
||||||
.asInstanceOf[ActorSystemImpl]
|
.asInstanceOf[ActorSystemImpl]
|
||||||
val remote2 = system2.provider.asInstanceOf[RemoteActorRefProvider]
|
val remote2 = system2.provider.asInstanceOf[RemoteActorRefProvider]
|
||||||
node2 = new Node(system2)
|
node2 = system2.node
|
||||||
|
|
||||||
Thread.sleep(10.seconds.dilated.toMillis)
|
Thread.sleep(10.seconds.dilated.toMillis)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue