Example usage for org.joda.time Minutes isLessThan

List of usage examples for org.joda.time Minutes isLessThan

Introduction

In this page you can find the example usage for org.joda.time Minutes isLessThan.

Prototype

public boolean isLessThan(Minutes other) 

Source Link

Document

Is this minutes instance less than the specified number of minutes.

Usage

From source file:com.google.android.apps.paco.EsmGenerator2.java

License:Open Source License

private boolean isMinimalBufferedDistanceFromOtherTimes(DateTime plusMinutes, Minutes timeoutInMinutes) {
    for (DateTime time : times) {

        Minutes minutesBetween;
        if (time.isAfter(plusMinutes)) {
            minutesBetween = Minutes.minutesBetween(plusMinutes, time);
        } else {/*from  w  ww  .j a  v a  2 s.  c  o m*/
            minutesBetween = Minutes.minutesBetween(time, plusMinutes);
        }

        if (minutesBetween.isLessThan(timeoutInMinutes)) {
            return false;
        }
    }
    return true;
}

From source file:org.apache.beam.sdk.io.kinesis.SimplifiedKinesisClient.java

License:Apache License

/**
 * Gets total size in bytes of all events that remain in Kinesis stream between specified
 * instants.// w  w w  .j ava  2 s.  c  o m
 *
 * @return total size in bytes of all Kinesis events after specified instant
 */
public long getBacklogBytes(final String streamName, final Instant countSince, final Instant countTo)
        throws TransientKinesisException {
    return wrapExceptions(() -> {
        Minutes period = Minutes.minutesBetween(countSince, countTo);
        if (period.isLessThan(Minutes.ONE)) {
            return 0L;
        }

        GetMetricStatisticsRequest request = createMetricStatisticsRequest(streamName, countSince, countTo,
                period);

        long totalSizeInBytes = 0;
        GetMetricStatisticsResult result = cloudWatch.getMetricStatistics(request);
        for (Datapoint point : result.getDatapoints()) {
            totalSizeInBytes += point.getSum().longValue();
        }
        return totalSizeInBytes;
    });
}