Skip to content
Snippets Groups Projects
Select Git revision
  • 9c09dff0bdeb34b10ec4878a2446c31b9753f2d9
  • master default
  • dev-group3-qdigest
  • dev-group2-all-aggregations
  • dev-group2-graphs
  • dev-group2-limit-neighbors
  • dev-group1-stefan
  • dev-group3-kim
  • dev-group1-simon
9 results

ServerActionJoin.java

  • user avatar
    Simon Könnecke authored
    9c09dff0
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ServerActionJoin.java 905 B
    package fucoin.actions.join;
    
    import akka.actor.ActorRef;
    import akka.actor.UntypedActorContext;
    import fucoin.actions.transaction.ActionInvokeDistributedCommittedTransfer;
    import fucoin.actions.transaction.SuperVisorAction;
    import fucoin.supervisor.SuperVisorImpl;
    
    public class ServerActionJoin extends SuperVisorAction {
        private String name;
    
        public ServerActionJoin(String name) {
            this.name = name;
        }
    
        @Override
        protected void onAction(ActorRef sender, ActorRef self,
                                UntypedActorContext context, SuperVisorImpl node) {
            ActionJoinAnswer aja = new ActionJoinAnswer();
            aja.someNeighbors.putAll(node.getKnownNeighbors());
            sender.tell(aja, self);
            node.addKnownNeighbor(name, sender);
            self.tell(
                    new ActionInvokeDistributedCommittedTransfer(self, sender, 100),
                    sender);
        }
    }