Incorporate feedback, see #2502
This commit is contained in:
parent
c5bdc636c9
commit
c959d4a973
10 changed files with 49 additions and 36 deletions
|
|
@ -36,6 +36,7 @@ object ClusterEvent {
|
|||
|
||||
/**
|
||||
* Java API
|
||||
* Read only
|
||||
*/
|
||||
def getMembers: java.lang.Iterable[Member] = {
|
||||
import scala.collection.JavaConverters._
|
||||
|
|
@ -44,6 +45,7 @@ object ClusterEvent {
|
|||
|
||||
/**
|
||||
* Java API
|
||||
* Read only
|
||||
*/
|
||||
def getUnreachable: java.util.Set[Member] = {
|
||||
import scala.collection.JavaConverters._
|
||||
|
|
@ -52,6 +54,7 @@ object ClusterEvent {
|
|||
|
||||
/**
|
||||
* Java API
|
||||
* Read only
|
||||
*/
|
||||
def getSeenBy: java.util.Set[Address] = {
|
||||
import scala.collection.JavaConverters._
|
||||
|
|
|
|||
|
|
@ -106,30 +106,30 @@ object MemberStatus {
|
|||
/**
|
||||
* JAVA API
|
||||
*/
|
||||
def joining: Object = Joining
|
||||
def joining: MemberStatus = Joining
|
||||
|
||||
/**
|
||||
* JAVA API
|
||||
*/
|
||||
def up: Object = Up
|
||||
def up: MemberStatus = Up
|
||||
|
||||
/**
|
||||
* JAVA API
|
||||
*/
|
||||
def leaving: Object = Leaving
|
||||
def leaving: MemberStatus = Leaving
|
||||
|
||||
/**
|
||||
* JAVA API
|
||||
*/
|
||||
def exiting: Object = Exiting
|
||||
def exiting: MemberStatus = Exiting
|
||||
|
||||
/**
|
||||
* JAVA API
|
||||
*/
|
||||
def down: Object = Down
|
||||
def down: MemberStatus = Down
|
||||
|
||||
/**
|
||||
* JAVA API
|
||||
*/
|
||||
def removed: Object = Removed
|
||||
def removed: MemberStatus = Removed
|
||||
}
|
||||
|
|
@ -232,7 +232,7 @@ is dynamically adjusted to reflect current network conditions.
|
|||
|
||||
The value of *phi* is calculated as::
|
||||
|
||||
phi = -log10(1 - F(timeSinceLastHeartbeat)
|
||||
phi = -log10(1 - F(timeSinceLastHeartbeat))
|
||||
|
||||
where F is the cumulative distribution function of a normal distribution with mean
|
||||
and standard deviation estimated from historical heartbeat inter-arrival times.
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ is dynamically adjusted to reflect current network conditions.
|
|||
|
||||
The value of *phi* is calculated as::
|
||||
|
||||
phi = -log10(1 - F(timeSinceLastHeartbeat)
|
||||
phi = -log10(1 - F(timeSinceLastHeartbeat))
|
||||
|
||||
where F is the cumulative distribution function of a normal distribution with mean
|
||||
and standard deviation estimated from historical heartbeat inter-arrival times.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package sample.cluster.simple.japi;
|
||||
|
||||
import akka.actor.UntypedActor;
|
||||
import akka.cluster.ClusterEvent.ClusterDomainEvent;
|
||||
import akka.cluster.ClusterEvent.CurrentClusterState;
|
||||
import akka.cluster.ClusterEvent.MemberJoined;
|
||||
import akka.cluster.ClusterEvent.MemberUnreachable;
|
||||
|
|
@ -29,8 +30,12 @@ public class SimpleClusterListener extends UntypedActor {
|
|||
MemberUnreachable mUnreachable = (MemberUnreachable) message;
|
||||
log.info("Member detected as unreachable: {}", mUnreachable.member());
|
||||
|
||||
} else {
|
||||
} else if (message instanceof ClusterDomainEvent) {
|
||||
// ignore
|
||||
|
||||
} else {
|
||||
unhandled(message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,19 +14,19 @@ public class StatsSampleMain {
|
|||
System.setProperty("akka.remote.netty.port", args[0]);
|
||||
|
||||
//#start-router-lookup
|
||||
ActorSystem system = ActorSystem.create("ClusterSystem", ConfigFactory
|
||||
.parseString(
|
||||
"akka.actor.deployment { \n"
|
||||
+ " /statsService/workerRouter { \n"
|
||||
+ " router = consistent-hashing \n"
|
||||
+ " nr-of-instances = 100 \n"
|
||||
+ " cluster { \n"
|
||||
+ " enabled = on \n"
|
||||
+ " routees-path = \"/user/statsWorker\" \n"
|
||||
+ " allow-local-routees = on \n"
|
||||
+ " } \n"
|
||||
+ " } \n"
|
||||
+ "} \n")
|
||||
ActorSystem system = ActorSystem.create("ClusterSystem",
|
||||
ConfigFactory.parseString(
|
||||
"akka.actor.deployment { \n" +
|
||||
" /statsService/workerRouter { \n" +
|
||||
" router = consistent-hashing \n" +
|
||||
" nr-of-instances = 100 \n" +
|
||||
" cluster { \n" +
|
||||
" enabled = on \n" +
|
||||
" routees-path = \"/user/statsWorker\" \n" +
|
||||
" allow-local-routees = on \n" +
|
||||
" } \n" +
|
||||
" } \n" +
|
||||
"} \n")
|
||||
.withFallback(ConfigFactory.load()));
|
||||
|
||||
system.actorOf(new Props(StatsWorker.class), "statsWorker");
|
||||
|
|
|
|||
|
|
@ -14,19 +14,19 @@ public class StatsSampleOneMasterMain {
|
|||
System.setProperty("akka.remote.netty.port", args[0]);
|
||||
|
||||
//#start-router-deploy
|
||||
ActorSystem system = ActorSystem.create("ClusterSystem", ConfigFactory
|
||||
.parseString(
|
||||
"akka.actor.deployment { \n"
|
||||
+ " /statsFacade/statsService/workerRouter { \n"
|
||||
+ " router = consistent-hashing \n"
|
||||
+ " nr-of-instances = 100 \n"
|
||||
+ " cluster { \n"
|
||||
+ " enabled = on \n"
|
||||
+ " max-nr-of-instances-per-node = 3 \n"
|
||||
+ " allow-local-routees = off \n"
|
||||
+ " } \n"
|
||||
+ " } \n"
|
||||
+ "} \n")
|
||||
ActorSystem system = ActorSystem.create("ClusterSystem",
|
||||
ConfigFactory.parseString(
|
||||
"akka.actor.deployment { \n" +
|
||||
" /statsFacade/statsService/workerRouter { \n" +
|
||||
" router = consistent-hashing \n" +
|
||||
" nr-of-instances = 100 \n" +
|
||||
" cluster { \n" +
|
||||
" enabled = on \n" +
|
||||
" max-nr-of-instances-per-node = 3 \n" +
|
||||
" allow-local-routees = off \n" +
|
||||
" } \n" +
|
||||
" } \n" +
|
||||
"} \n")
|
||||
.withFallback(ConfigFactory.load()));
|
||||
|
||||
system.actorOf(new Props(StatsFacade.class), "statsFacade");
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ public class TransformationFrontendMain {
|
|||
System.out.println(result);
|
||||
}
|
||||
}, ec);
|
||||
|
||||
// wait a while until next request,
|
||||
// to avoid flooding the console with output
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
system.shutdown();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ object SimpleClusterApp {
|
|||
log.info("Member is Up: {}", member)
|
||||
case MemberUnreachable(member) ⇒
|
||||
log.info("Member detected as unreachable: {}", member)
|
||||
case _ ⇒ // ignore
|
||||
case _: ClusterDomainEvent ⇒ // ignore
|
||||
|
||||
}
|
||||
}), name = "clusterListener")
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ object TransformationFrontend {
|
|||
(frontend ? TransformationJob("hello-" + n)) onSuccess {
|
||||
case result ⇒ println(result)
|
||||
}
|
||||
// wait a while until next request,
|
||||
// to avoid flooding the console with output
|
||||
Thread.sleep(2000)
|
||||
}
|
||||
system.shutdown()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue