private void schedulePeriodicAggregation() {
   SchedulePeriodicTimeout spt =
       new SchedulePeriodicTimeout(
           aggregatorConfig.aggregationPeriod, aggregatorConfig.aggregationPeriod);
   AggregationTimeout agt = new AggregationTimeout(spt);
   spt.setTimeoutEvent(agt);
   trigger(spt, timer);
   aggregationTid = agt.getTimeoutId();
 }
예제 #2
0
 private void schedulePeriodicShuffle() {
   if (shuffleCycleId != null) {
     log.warn("{} double starting periodic shuffle", logPrefix);
     return;
   }
   SchedulePeriodicTimeout spt =
       new SchedulePeriodicTimeout(croupierConfig.shufflePeriod, croupierConfig.shufflePeriod);
   ShuffleCycle sc = new ShuffleCycle(spt);
   spt.setTimeoutEvent(sc);
   shuffleCycleId = sc.getTimeoutId();
   trigger(spt, timer);
 }
예제 #3
0
        @Override
        public void handle(TManInit init) {
          self = init.getSelf();
          partitionID = getPartitionID(self);
          tmanConfiguration = init.getConfiguration();
          period = tmanConfiguration.getPeriod();
          uc = new UtilityComparator(self);

          SchedulePeriodicTimeout rst = new SchedulePeriodicTimeout(period, period);
          rst.setTimeoutEvent(new TManSchedule(rst));
          trigger(rst, timerPort);

          SchedulePeriodicTimeout grst = new SchedulePeriodicTimeout(period, period);
          grst.setTimeoutEvent(new TManGossipTimeout(grst));
          trigger(grst, timerPort);
        }
예제 #4
0
        @Override
        public void handle(SearchInit init) {
          self = init.getSelf();

          ///
          // Regularly, we will try to find out who the leader to accelerate convergence in a
          // request by our peer.
          // To ensure that all nodes make their request at the same time, the launch is shifted
          // randomly.
          ///
          SchedulePeriodicTimeout rst =
              new SchedulePeriodicTimeout(
                  new Random().nextInt(config_timeout_update), config_timeout_update);
          rst.setTimeoutEvent(new UpdateLeaderTimeout(rst));
          trigger(rst, timerPort);
        }
예제 #5
0
        public void handle(BootstrapResponse event) {
          if (!bootstrapped) {
            bootstrapped = true;
            PeerAddress peer;
            Set<PeerEntry> somePeers = event.getPeers();

            for (PeerEntry peerEntry : somePeers) {
              peer = (PeerAddress) peerEntry.getOverlayAddress();
              friends.addElement(peer);
              fdRegister(peer);
            }

            trigger(
                new BootstrapCompleted("Lab0", serverPeerAddress),
                bootstrap.getPositive(P2pBootstrap.class));
            Snapshot.addFriends(serverPeerAddress, friends);

            SchedulePeriodicTimeout spt = new SchedulePeriodicTimeout(msgPeriod, msgPeriod);
            spt.setTimeoutEvent(new SendMessage(spt));
            trigger(spt, timer);
          }
        }