Examples of TruncatedBinaryBackoff


Examples of com.twitter.common.util.TruncatedBinaryBackoff

    install(new PrivateModule() {
      @Override
      protected void configure() {
        bind(TaskGroupsSettings.class).toInstance(new TaskGroupsSettings(
            new TruncatedBinaryBackoff(INITIAL_SCHEDULE_DELAY.get(), MAX_SCHEDULE_DELAY.get()),
            RateLimiter.create(MAX_SCHEDULE_ATTEMPTS_PER_SEC.get())));

        bind(RescheduleCalculatorImpl.RescheduleCalculatorSettings.class)
            .toInstance(new RescheduleCalculatorImpl.RescheduleCalculatorSettings(
                new TruncatedBinaryBackoff(INITIAL_FLAPPING_DELAY.get(), MAX_FLAPPING_DELAY.get()),
                FLAPPING_THRESHOLD.get(),
                MAX_RESCHEDULING_DELAY.get()));

        bind(RescheduleCalculator.class).to(RescheduleCalculatorImpl.class).in(Singleton.class);
        expose(RescheduleCalculator.class);
View Full Code Here

Examples of com.twitter.common.util.TruncatedBinaryBackoff

    install(new PrivateModule() {
      @Override
      protected void configure() {
        bind(TaskGroupsSettings.class).toInstance(new TaskGroupsSettings(
            FIRST_SCHEDULE_DELAY.get(),
            new TruncatedBinaryBackoff(
                INITIAL_SCHEDULE_PENALTY.get(),
                MAX_SCHEDULE_PENALTY.get()),
            RateLimiter.create(MAX_SCHEDULE_ATTEMPTS_PER_SEC.get())));

        bind(RescheduleCalculatorImpl.RescheduleCalculatorSettings.class)
            .toInstance(new RescheduleCalculatorImpl.RescheduleCalculatorSettings(
                new TruncatedBinaryBackoff(INITIAL_FLAPPING_DELAY.get(), MAX_FLAPPING_DELAY.get()),
                FLAPPING_THRESHOLD.get(),
                MAX_RESCHEDULING_DELAY.get()));

        bind(RescheduleCalculator.class).to(RescheduleCalculatorImpl.class).in(Singleton.class);
        expose(RescheduleCalculator.class);
        if (enablePreemptor) {
          bind(PREEMPTOR_KEY).to(PreemptorImpl.class);
          bind(PreemptorImpl.class).in(Singleton.class);
          LOG.info("Preemptor Enabled.");
        } else {
          bind(PREEMPTOR_KEY).toInstance(NULL_PREEMPTOR);
          LOG.warning("Preemptor Disabled.");
        }
        expose(PREEMPTOR_KEY);
        bind(new TypeLiteral<Amount<Long, Time>>() { }).annotatedWith(PreemptionDelay.class)
            .toInstance(PREEMPTION_DELAY.get());
        bind(TaskGroups.class).in(Singleton.class);
        expose(TaskGroups.class);
      }
    });
    bindTaskScheduler(binder(), PREEMPTOR_KEY, RESERVATION_DURATION.get());
    PubsubEventModule.bindSubscriber(binder(), TaskGroups.class);

    install(new PrivateModule() {
      @Override
      protected void configure() {
        bind(OfferReturnDelay.class).toInstance(
            new RandomJitterReturnDelay(
                MIN_OFFER_HOLD_TIME.get().as(Time.MILLISECONDS),
                OFFER_HOLD_JITTER_WINDOW.get().as(Time.MILLISECONDS),
                new Random.SystemRandom(new java.util.Random())));
        bind(ScheduledExecutorService.class).toInstance(executor);
        bind(OfferQueue.class).to(OfferQueueImpl.class);
        bind(OfferQueueImpl.class).in(Singleton.class);
        expose(OfferQueue.class);
      }
    });
    PubsubEventModule.bindSubscriber(binder(), OfferQueue.class);

    install(new PrivateModule() {
      @Override
      protected void configure() {
        // TODO(ksweeney): Create a configuration validator module so this can be injected.
        // TODO(William Farner): Revert this once large task counts is cheap ala hierarchichal store
        bind(HistoryPrunnerSettings.class).toInstance(new HistoryPrunnerSettings(
            HISTORY_PRUNE_THRESHOLD.get(),
            HISTORY_MIN_RETENTION_THRESHOLD.get(),
            HISTORY_MAX_PER_JOB_THRESHOLD.get()
        ));
        bind(ScheduledExecutorService.class).toInstance(executor);

        bind(TaskHistoryPruner.class).in(Singleton.class);
        expose(TaskHistoryPruner.class);
      }
    });
    PubsubEventModule.bindSubscriber(binder(), TaskHistoryPruner.class);

    install(new PrivateModule() {
      @Override
      protected void configure() {
        bind(ScheduledExecutorService.class).toInstance(executor);
        bind(TaskThrottler.class).in(Singleton.class);
        expose(TaskThrottler.class);
      }
    });
    PubsubEventModule.bindSubscriber(binder(), TaskThrottler.class);

    install(new PrivateModule() {
      @Override
      protected void configure() {
        bind(GcExecutorSettings.class).toInstance(new RandomGcExecutorSettings(
            EXECUTOR_GC_INTERVAL.get(),
            Optional.fromNullable(GC_EXECUTOR_PATH.get())));
        bind(Executor.class).toInstance(executor);

        bind(GcExecutorLauncher.class).in(Singleton.class);
        expose(GcExecutorLauncher.class);
      }
    });

    install(new PrivateModule() {
      @Override
      protected void configure() {
        bind(JobUpdateHistoryPruner.HistoryPrunerSettings.class).toInstance(
            new JobUpdateHistoryPruner.HistoryPrunerSettings(
                JOB_UPDATE_HISTORY_PRUNING_INTERVAL.get(),
                JOB_UPDATE_HISTORY_PRUNING_THRESHOLD.get(),
                JOB_UPDATE_HISTORY_PER_JOB_THRESHOLD.get()));

        bind(ScheduledExecutorService.class).toInstance(
            AsyncUtil.singleThreadLoggingScheduledExecutor("JobUpdatePruner-%d", LOG));

        bind(JobUpdateHistoryPruner.class).in(Singleton.class);
        expose(JobUpdateHistoryPruner.class);
      }
    });
    LifecycleModule.bindStartupAction(binder(), JobUpdateHistoryPruner.class);

    install(new PrivateModule() {
      @Override
      protected void configure() {
        bind(ScheduledExecutorService.class).toInstance(executor);
        bind(BackoffStrategy.class).toInstance(
            new TruncatedBinaryBackoff(
                INITIAL_TASK_KILL_RETRY_INTERVAL.get(),
                TRANSIENT_TASK_STATE_TIMEOUT.get()));
        bind(KillRetry.class).in(Singleton.class);
        expose(KillRetry.class);
      }
View Full Code Here

Examples of com.twitter.common.util.TruncatedBinaryBackoff

            bind(Driver.class).toInstance(driver);
            bind(TaskIdGenerator.class).to(TaskIdGeneratorImpl.class);
            bind(RescheduleCalculator.class).to(RescheduleCalculatorImpl.class);
            bind(RescheduleCalculatorImpl.RescheduleCalculatorSettings.class)
                .toInstance(new RescheduleCalculatorImpl.RescheduleCalculatorSettings(
                    new TruncatedBinaryBackoff(
                        Amount.of(1L, Time.SECONDS), Amount.of(1L, Time.MINUTES)),
                    FLAPPING_THRESHOLD,
                    Amount.of(1, Time.MINUTES)));
            bind(EventSink.class).toInstance(new EventSink() {
              @Override
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.