Package org.joda.time

Examples of org.joda.time.Duration


              didTerminate = true;
            }
          }
        }
      } else {
        Duration durSinceLastTerminate = new Duration(lastTerminateTime, new DateTime());

        log.info("%s terminating. Current wait time: %s", currentlyTerminating, durSinceLastTerminate);

        if (durSinceLastTerminate.isLongerThan(config.getMaxScalingDuration().toStandardDuration())) {
          log.makeAlert("Worker node termination taking too long!")
             .addData("millisSinceLastTerminate", durSinceLastTerminate.getMillis())
             .addData("terminatingCount", currentlyTerminating.size())
             .emit();

          currentlyTerminating.clear();
        }
View Full Code Here


  private boolean hasTaskPendingBeyondThreshold(Collection<RemoteTaskRunnerWorkItem> pendingTasks)
  {
    synchronized (lock) {
      long now = System.currentTimeMillis();
      for (TaskRunnerWorkItem pendingTask : pendingTasks) {
        final Duration durationSinceInsertion = new Duration(pendingTask.getQueueInsertionTime().getMillis(), now);
        final Duration timeoutDuration = config.getPendingTaskTimeout().toStandardDuration();
        if (durationSinceInsertion.isEqual(timeoutDuration) || durationSinceInsertion.isLongerThan(timeoutDuration)) {
          return true;
        }
      }
      return false;
View Full Code Here

      PeriodGranularity granularity = new PeriodGranularity(period, config.getOriginTime(), null);
      final long startTime = granularity.next(granularity.truncate(new DateTime().getMillis()));

      ScheduledExecutors.scheduleAtFixedRate(
          exec,
          new Duration(System.currentTimeMillis(), startTime),
          config.getTerminatePeriod().toStandardDuration(),
          new Runnable()
          {
            @Override
            public void run()
View Full Code Here

  {
    if (hasExceededRetryThreshold()) {
      return null;
    }

    Duration retVal = currRetryDelay;
    currRetryDelay = new Duration(Math.min(currRetryDelay.getMillis() * 2, maxRetryDelay.getMillis()));
    ++retryCount;
    return retVal;
  }
View Full Code Here

        return;
      }

      this.exec = Execs.scheduledSingleThreaded("DatabaseSegmentManager-Exec--%d");

      final Duration delay = config.get().getPollDuration().toStandardDuration();
      ScheduledExecutors.scheduleWithFixedDelay(
          exec,
          new Duration(0),
          delay,
          new Runnable()
          {
            @Override
            public void run()
View Full Code Here

  @Override
  public Duration getDuration()
  {
    if (duration == null) {
      Duration totalDuration = new Duration(0);
      for (Interval interval : querySegmentSpec.getIntervals()) {
        if (interval != null) {
          totalDuration = totalDuration.plus(interval.toDuration());
        }
      }
      duration = totalDuration;
    }
View Full Code Here

      }

      @Override
      public Duration getStartDelay()
      {
        return new Duration(0);
      }

      @Override
      public Duration getPeriod()
      {
        return new Duration(Long.MAX_VALUE);
      }

      @Override
      public String getBrokerServiceName()
      {
View Full Code Here

  }

  @Config("druid.coordinator.load.timeout")
  public Duration getLoadTimeoutDelay()
  {
    return new Duration(15 * 60 * 1000);
  }
View Full Code Here

            .setMinWait(new Period("PT1S"))
            .setMaxWait(new Period("PT10S"))
            .setMaxRetryCount(6)
    );

    Assert.assertEquals(new Duration("PT1S"), retryPolicy.getAndIncrementRetryDelay());
    Assert.assertEquals(new Duration("PT2S"), retryPolicy.getAndIncrementRetryDelay());
    Assert.assertEquals(new Duration("PT4S"), retryPolicy.getAndIncrementRetryDelay());
    Assert.assertEquals(new Duration("PT8S"), retryPolicy.getAndIncrementRetryDelay());
    Assert.assertEquals(new Duration("PT10S"), retryPolicy.getAndIncrementRetryDelay());
    Assert.assertEquals(new Duration("PT10S"), retryPolicy.getAndIncrementRetryDelay());
    Assert.assertEquals(null, retryPolicy.getAndIncrementRetryDelay());
    Assert.assertTrue(retryPolicy.hasExceededRetryThreshold());
  }
View Full Code Here

      fileWriter = new OutputStreamWriter(
          new FileOutputStream(new File(baseDir, currentDay.toString("yyyy-MM-dd'.log'")), true),
          Charsets.UTF_8
      );
      long nextDay = currentDay.plusDays(1).getMillis();
      Duration delay = new Duration(nextDay - new DateTime().getMillis());

      ScheduledExecutors.scheduleWithFixedDelay(
          exec,
          delay,
          Duration.standardDays(1),
View Full Code Here

TOP

Related Classes of org.joda.time.Duration

Copyright © 2018 www.massapicom. 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.