@Override public void preStart() { ActorRefProvider provider = getContext().provider(); selfAddress = provider.getDefaultAddress(); bucketStore = new BucketStoreAccess(getContext(), config.getAskDuration()); if (provider instanceof ClusterActorRefProvider) { cluster = Cluster.get(getContext().system()); cluster.subscribe(getSelf(), ClusterEvent.initialStateAsEvents(), ClusterEvent.MemberEvent.class, ClusterEvent.ReachableMember.class, ClusterEvent.UnreachableMember.class); } if (autoStartGossipTicks) { gossipTask = getContext().system().scheduler().schedule( new FiniteDuration(1, TimeUnit.SECONDS), //initial delay config.getGossipTickInterval(), //interval getSelf(), //target GOSSIP_TICK, //message getContext().dispatcher(), //execution context getSelf() //sender ); } }
@Override public void preStart() { ActorRefProvider provider = getContext().provider(); selfAddress = provider.getDefaultAddress(); if (provider instanceof ClusterActorRefProvider) { getContext().actorOf(Gossiper.props(config).withMailbox(config.getMailBoxName()), "gossiper"); } }