@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; } return duration; }
@Override public Duration add(Duration d) { if (d instanceof DurationWithMillis) { return new DurationWithMillis(this, base.toDuration().plus(((DurationWithMillis) d).base)); } else if (d instanceof DurationWithFields) { return ((DurationWithFields) d).add(this); } else { throw new UnsupportedOperationException("Unknown duration type in add: " + d.getClass()); } }
private void sampleFormatElapsedTime() { List<String> text = new ArrayList<String>(); text.add("25 seconds: " + DateUtils.formatElapsedTime(Duration.standardSeconds(25))); text.add("3 minutes: " + DateUtils.formatElapsedTime(Duration.standardMinutes(3))); text.add("3 minutes, 25 seconds: " + DateUtils.formatElapsedTime( Duration.standardMinutes(3).plus(Duration.standardSeconds(25)))); text.add("3 hours: " + DateUtils.formatElapsedTime(Duration.standardHours(3))); text.add("3 hours, 3 minutes: " + DateUtils.formatElapsedTime( Duration.standardHours(3).plus(Duration.standardMinutes(3)))); addSample("DateUtils.formatElapsedTime()", text); }
Duration d = p.toStandardDuration().plus(millis); return d; } else {
@Test(expected = IllegalArgumentException.class) public void testProcessRunnerWithMoreThanMaxAllowedTimeout() { RUNNER.executeCommands(Arrays.asList("ls", "/some/dir/that/should/not/exist"), ProcessRunner.DEFAULT_MAX_TIMEOUT.plus(1000)); Assert.fail("Illegal argument exception was expected"); } }
@Override public Duration hintDuration() { return duration.plus(chain.stream().map(ExpressionLookBack::hintDuration).max(Comparator.naturalOrder()).orElse(Duration.ZERO)); } };
/** * This method generates a random duration between 5 and 10 minutes. This is the duration used * to get the updated capacity unit information from the table. */ private Duration getUpdateDuration() { Random random = new Random(System.currentTimeMillis()); long randomDuration = random.nextInt(5 * 60 * 1000); return Duration.standardMinutes(5).plus(randomDuration); }
private Duration calcTotalDuration(final Collection<Interval> intervals) { Duration duration = Duration.ZERO; for (Interval interval : intervals) { duration = duration.plus(interval.toDuration()); } return duration; }
@Override public Duration hintDuration() { return duration.plus(elb.hintDuration()); } };
/** * This method generates a random duration between 5 and 10 minutes. This is the duration used * to get the updated capacity unit information from the table. */ private Duration getUpdateDuration() { Random random = new Random(System.currentTimeMillis()); long randomDuration = random.nextInt(5 * 60 * 1000); return Duration.standardMinutes(5).plus(randomDuration); }
public Duration getTotalShiftsDuration() { Duration totalDuration = Duration.ZERO; for (Shift shift : getAssociatedShifts()) { totalDuration = totalDuration.plus(shift.getTotalDuration()); } return totalDuration; }
@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; } return duration; }
@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; } return duration; }
@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; } return duration; }
public Duration add(Duration d) { if (d instanceof DurationWithMillis) { return new DurationWithMillis(this, base.toDuration().plus(((DurationWithMillis) d).base)); } else if (d instanceof DurationWithFields) { return ((DurationWithFields) d).add(this); } else { throw new UnsupportedOperationException("Unknown duration type in add: " + d.getClass()); } }
@Override public Duration add(Duration d) { if (d instanceof DurationWithMillis) { return new DurationWithMillis(this, base.toDuration().plus(((DurationWithMillis) d).base)); } else if (d instanceof DurationWithFields) { return ((DurationWithFields) d).add(this); } else { throw new UnsupportedOperationException("Unknown duration type in add: " + d.getClass()); } }
public Duration add(Duration d) { if (d instanceof DurationWithMillis) { return new DurationWithMillis(this, base.toDuration().plus(((DurationWithMillis) d).base)); } else if (d instanceof DurationWithFields) { return ((DurationWithFields) d).add(this); } else { throw new UnsupportedOperationException("Unknown duration type in add: " + d.getClass()); } }
public Duration getTotalDuration() { Duration duration = Duration.ZERO; Collection<Lesson> lessons = getAssociatedLessonsSet(); for (Lesson lesson : lessons) { duration = duration.plus(lesson.getTotalDuration()); } return duration; }
protected Duration getDurationAtLevel( int sleelLevel ) { Duration duration = new Duration( 0 ); for ( SleepLevel level : this.getSleepLevels( ) ) { if ( level.getValue( ) == sleelLevel ) duration = duration.plus( level.getInterval( ).toDuration( ) ); } return duration; } }
@Test public void watermarkIsUpdatedToRecentRecordTimestampIfItIsOlderThanUpdateThreshold() { Instant firstTimestamp = now.minus(Duration.standardHours(1)); watermark.update(firstTimestamp); assertThat(watermark.getCurrent(SHARDS_IRRELEVANT)).isEqualTo(firstTimestamp); Instant timeAfterWatermarkUpdateThreshold = now.plus(KinesisWatermark.UPDATE_THRESHOLD.plus(Duration.millis(1))); setCurrentTimeTo(timeAfterWatermarkUpdateThreshold); Instant nextTimestamp = timeAfterWatermarkUpdateThreshold.plus(Duration.millis(1)); watermark.update(nextTimestamp); assertThat(watermark.getCurrent(SHARDS_IRRELEVANT)).isEqualTo(nextTimestamp); }