Skip to content

Commit

Permalink
fix a bug when there is only a single node.
Browse files Browse the repository at this point in the history
  • Loading branch information
zarinfam committed Oct 4, 2014
1 parent 99bc743 commit 9e554fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,12 @@ no matter which node receives the message.

run node1:

activator -Dnode.id=1 -Dhttp.port=9000 -Dakka.remote.netty.tcp.port=2551
-Dakka.cluster.seed-nodes.0="akka.tcp://application@127.0.0.1:2551"
run
activator -Dnode.id=1 -Dhttp.port=9000 -Dakka.remote.netty.tcp.port=2551 -Dakka.cluster.seed-nodes.0="akka.tcp://application@127.0.0.1:2551" run

run node2:

activator -Dnode.id=2 -Dhttp.port=9001 -Dakka.remote.netty.tcp.port=2552
-Dakka.cluster.seed-nodes.0="akka.tcp://application@127.0.0.1:2551"
-Dakka.cluster.seed-nodes.1="akka.tcp://application@127.0.0.1:2552"
run
activator -Dnode.id=2 -Dhttp.port=9001 -Dakka.remote.netty.tcp.port=2552 -Dakka.cluster.seed-nodes.0="akka.tcp://application@127.0.0.1:2551" -Dakka.cluster.seed-nodes.1="akka.tcp://application@127.0.0.1:2552" run

run node3:

activator -Dnode.id=3 -Dhttp.port=9002 -Dakka.remote.netty.tcp.port=2553
-Dakka.cluster.seed-nodes.0="akka.tcp://application@127.0.0.1:2551"
-Dakka.cluster.seed-nodes.1="akka.tcp://application@127.0.0.1:2552"
-Dakka.cluster.seed-nodes.2="akka.tcp://application@127.0.0.1:2553"
run
activator -Dnode.id=3 -Dhttp.port=9002 -Dakka.remote.netty.tcp.port=2553 -Dakka.cluster.seed-nodes.0="akka.tcp://application@127.0.0.1:2551" -Dakka.cluster.seed-nodes.1="akka.tcp://application@127.0.0.1:2552" -Dakka.cluster.seed-nodes.2="akka.tcp://application@127.0.0.1:2553" run
12 changes: 8 additions & 4 deletions app/controllers/Greeter.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,17 @@ public void onReceive(Object message) {
// getSender().tell(Msg.DONE, getSelf());
}else if (message == Msg.NOTIFY_ALL){
PlayInternal.logger().info("---------------> start notify");
for(Member member: clusterMemberList){
PlayInternal.logger().info("---------------> notify = "+member.address());
getContext().actorSelection(member.address()+"/user/Greeter").tell(
Greeter.Msg.GREET, getSelf());
if (clusterMemberList.size() != 0) {
for (Member member : clusterMemberList) {
PlayInternal.logger().info("---------------> notify = " + member.address());
getContext().actorSelection(member.address() + "/user/Greeter").tell(
Greeter.Msg.GREET, getSelf());

// member.tell(Greeter.Msg.GREET, null);

}
}else{
actorRef.tell(Msg.GREET, getSelf());
}
}
else if (message instanceof ClusterEvent.MemberUp) {
Expand Down

0 comments on commit 9e554fd

Please sign in to comment.