Skip to content
Snippets Groups Projects
ServerActionJoin.java 919 B
Newer Older
Michael Kmoch's avatar
Michael Kmoch committed
package fucoin.actions.join;

import akka.actor.ActorRef;
import akka.actor.UntypedActorContext;
import fucoin.actions.transaction.ActionInvokeDistributedCommittedTransfer;
Michael Kmoch's avatar
Michael Kmoch committed
import fucoin.actions.transaction.SuperVisorAction;
Michael Kmoch's avatar
Michael Kmoch committed

public class ServerActionJoin extends SuperVisorAction {
Michael Kmoch's avatar
Michael Kmoch committed

    public ServerActionJoin(String name) {
        this.name = name;
    }
Michael Kmoch's avatar
Michael Kmoch committed

    @Override
    protected void onAction(ActorRef sender, ActorRef self,
                            UntypedActorContext context, SuperVisorImpl node) {
        ActionJoinAnswer aja = new ActionJoinAnswer(node.getSelf());
        aja.someNeighbors.putAll(node.getKnownNeighbors());
        sender.tell(aja, self);
        node.addKnownNeighbor(name, sender);
        self.tell(
                new ActionInvokeDistributedCommittedTransfer(self, sender, 100),
Michael Kmoch's avatar
Michael Kmoch committed
}