Added outline on how to implement clustered deployment
This commit is contained in:
parent
517f9a212b
commit
13abf0592f
4 changed files with 19 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -50,3 +50,4 @@ akka-docs/_build/
|
||||||
akka-tutorials/akka-tutorial-first/project/boot/
|
akka-tutorials/akka-tutorial-first/project/boot/
|
||||||
akka-tutorials/akka-tutorial-first/project/plugins/project/
|
akka-tutorials/akka-tutorial-first/project/plugins/project/
|
||||||
akka-docs/exts/
|
akka-docs/exts/
|
||||||
|
_akka_cluster/
|
||||||
|
|
@ -206,8 +206,20 @@ object Actor extends ListenerManagement {
|
||||||
newLocalActorRef(clazz, address)
|
newLocalActorRef(clazz, address)
|
||||||
|
|
||||||
case Deploy(_, router, Clustered(Home(hostname, port), replication , state)) =>
|
case Deploy(_, router, Clustered(Home(hostname, port), replication , state)) =>
|
||||||
|
sys.error("Clustered deployment not yet supported")
|
||||||
|
/*
|
||||||
|
if (Actor.remote.isRunning) throw new IllegalStateException("Remote server is not running")
|
||||||
|
val remoteAddress = Actor.remote.address
|
||||||
|
if (remoteAddress.getHostName == hostname && remoteAddress.getPort == port) {
|
||||||
|
// home node for actor
|
||||||
|
if (!node.isClustered(address)) node.store(clazz, address)
|
||||||
|
node.use(address).head
|
||||||
|
} else {
|
||||||
|
val router =
|
||||||
|
node.ref(address, router)
|
||||||
|
}
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
1. Check ZK for deployment config
|
|
||||||
2. Check Home(..)
|
2. Check Home(..)
|
||||||
a) If home is same as Actor.remote.address then:
|
a) If home is same as Actor.remote.address then:
|
||||||
- check if actor is stored in ZK, if not; node.store(..)
|
- check if actor is stored in ZK, if not; node.store(..)
|
||||||
|
|
@ -216,7 +228,6 @@ object Actor extends ListenerManagement {
|
||||||
- check out actor using node.ref(..)
|
- check out actor using node.ref(..)
|
||||||
|
|
||||||
Misc stuff:
|
Misc stuff:
|
||||||
- Manage deployment in ZK
|
|
||||||
- How to define a single ClusterNode to use? Where should it be booted up? How should it be configured?
|
- How to define a single ClusterNode to use? Where should it be booted up? How should it be configured?
|
||||||
- Deployer should:
|
- Deployer should:
|
||||||
1. Check if deployment exists in ZK
|
1. Check if deployment exists in ZK
|
||||||
|
|
|
||||||
|
|
@ -143,10 +143,6 @@ object Deployer {
|
||||||
lazy val cluster = ReflectiveAccess.ClusterModule.clusterDeployer
|
lazy val cluster = ReflectiveAccess.ClusterModule.clusterDeployer
|
||||||
lazy val local = new LocalDeployer
|
lazy val local = new LocalDeployer
|
||||||
|
|
||||||
def deploy(deployment: Seq[Deploy]) {
|
|
||||||
deployment foreach (deploy(_))
|
|
||||||
}
|
|
||||||
|
|
||||||
def deploy(deployment: Deploy) {
|
def deploy(deployment: Deploy) {
|
||||||
if (deployment eq null) throw new IllegalArgumentException("Deploy can not be null")
|
if (deployment eq null) throw new IllegalArgumentException("Deploy can not be null")
|
||||||
val address = deployment.address
|
val address = deployment.address
|
||||||
|
|
@ -155,6 +151,10 @@ object Deployer {
|
||||||
else local.deploy(deployment)
|
else local.deploy(deployment)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def deploy(deployment: Seq[Deploy]) {
|
||||||
|
deployment foreach (deploy(_))
|
||||||
|
}
|
||||||
|
|
||||||
private def deployLocally(deployment: Deploy) {
|
private def deployLocally(deployment: Deploy) {
|
||||||
deployment match {
|
deployment match {
|
||||||
case Deploy(address, Direct, Clustered(Home(hostname, port), _, _)) =>
|
case Deploy(address, Direct, Clustered(Home(hostname, port), _, _)) =>
|
||||||
|
|
|
||||||
|
|
@ -561,7 +561,7 @@ class ClusterNode private[akka] (
|
||||||
/**
|
/**
|
||||||
* Explicitly resign from being a leader. If this node is not a leader then this operation is a no-op.
|
* Explicitly resign from being a leader. If this node is not a leader then this operation is a no-op.
|
||||||
*/
|
*/
|
||||||
def resign = if (isLeader.get) leaderLock.unlock
|
def resign() { if (isLeader.get) leaderLock.unlock }
|
||||||
|
|
||||||
// =======================================
|
// =======================================
|
||||||
// Actor
|
// Actor
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue