Skip to content
Snippets Groups Projects
ActionInvokeLeave.java 689 B
Newer Older
Michael Kmoch's avatar
Michael Kmoch committed
package fucoin.actions.persist;

import akka.actor.ActorRef;
import akka.actor.UntypedActorContext;
Michael Kmoch's avatar
Michael Kmoch committed

public class ActionInvokeLeave extends Persist {
Michael Kmoch's avatar
Michael Kmoch committed

    @Override
    protected void onAction(ActorRef sender, ActorRef self,
                            UntypedActorContext context, AbstractWallet wallet) {
        for (ActorRef neighbor : wallet.getKnownNeighbors().values()) {
            if (self.compareTo(neighbor) != 0) {
                neighbor.tell(new ActionStoreOrUpdate(wallet), self);
            }
        }


        wallet.setActive(false);
        wallet.backedUpNeighbors.clear();
        wallet.getKnownNeighbors().clear();
    }