Example usage for org.joda.time Duration ZERO

List of usage examples for org.joda.time Duration ZERO

Introduction

In this page you can find the example usage for org.joda.time Duration ZERO.

Prototype

Duration ZERO

To view the source code for org.joda.time Duration ZERO.

Click Source Link

Document

Constant representing zero millisecond duration

Usage

From source file:fi.hsl.parkandride.core.domain.HasInterval.java

License:EUPL

default Duration overlapWith(Interval interval) {
    return Optional.ofNullable(interval).map(i -> getInterval().overlap(i)).map(Interval::toDuration)
            .orElse(Duration.ZERO);
}

From source file:fi.hsl.parkandride.core.domain.prediction.PredictionRequest.java

License:EUPL

static Duration parseRelativeTime(String relativeTime) {
    Matcher matcher = java.util.regex.Pattern.compile(HHMM_PATTERN).matcher(relativeTime);
    if (matcher.matches()) {
        int hours = parseOptionalInt(matcher.group(2));
        int minutes = Integer.parseInt(matcher.group(3));
        return standardHours(hours).plus(standardMinutes(minutes));
    } else {/*w w w . j  a va  2s .  c  o m*/
        return Duration.ZERO;
    }
}

From source file:fi.hsl.parkandride.core.domain.PredictionRequest.java

License:EUPL

private static Duration parseRelativeTime(String relativeTime) {
    Matcher matcher = java.util.regex.Pattern.compile("(?:(\\d+):)?(\\d+)").matcher(relativeTime);
    if (matcher.matches()) {
        int hours = parseOptionalInt(matcher.group(1));
        int minutes = Integer.parseInt(matcher.group(2));
        return standardHours(hours).plus(standardMinutes(minutes));
    } else {//  w w w.j  a  va2  s  .com
        return Duration.ZERO;
    }
}

From source file:google.registry.config.RegistryConfig.java

License:Open Source License

/** Returns the amount of time a singleton should be cached, before expiring. */
public static Duration getSingletonCacheRefreshDuration() {
    switch (RegistryEnvironment.get()) {
    case UNITTEST:
        // All cache durations are set to zero so that unit tests can update and then retrieve data
        // immediately without failure.
        return Duration.ZERO;
    default:/* ww w  .j  ava  2 s . c o  m*/
        return Duration.standardMinutes(10);
    }
}

From source file:google.registry.config.RegistryConfig.java

License:Open Source License

/**
 * Returns the amount of time a domain label list should be cached in memory before expiring.
 *
 * @see google.registry.model.registry.label.ReservedList
 * @see google.registry.model.registry.label.PremiumList
 *//*  w  w  w. ja va  2s .  c  o m*/
public static Duration getDomainLabelListCacheDuration() {
    switch (RegistryEnvironment.get()) {
    case UNITTEST:
        return Duration.ZERO;
    default:
        return Duration.standardHours(1);
    }
}

From source file:google.registry.config.RegistryConfig.java

License:Open Source License

/** Returns the amount of time a singleton should be cached in persist mode, before expiring. */
public static Duration getSingletonCachePersistDuration() {
    switch (RegistryEnvironment.get()) {
    case UNITTEST:
        return Duration.ZERO;
    default:/*from  w w  w  .ja  va2 s .co m*/
        return Duration.standardDays(365);
    }
}

From source file:google.registry.config.RegistryConfig.java

License:Open Source License

/**
 * Returns the base retry duration that gets doubled after each failure within {@code Ofy}.
 *///from w  w  w.  ja v  a  2s . com
public static Duration getBaseOfyRetryDuration() {
    switch (RegistryEnvironment.get()) {
    case UNITTEST:
        return Duration.ZERO;
    default:
        return Duration.millis(100);
    }
}

From source file:google.registry.model.registry.Registry.java

License:Open Source License

public Interval getLrpPeriod() {
    return (lrpPeriodStart == null && lrpPeriodEnd == null) ? new Interval(START_OF_TIME, Duration.ZERO) // An empty duration.
            : new Interval(lrpPeriodStart, lrpPeriodEnd);
}

From source file:google.registry.rde.PendingDepositChecker.java

License:Open Source License

private ImmutableSetMultimap<String, PendingDeposit> getTldsAndWatermarksPendingDeposit(RdeMode mode,
        CursorType cursorType, Duration interval, DateTime startingPoint) {
    checkArgument(interval.isLongerThan(Duration.ZERO));
    ImmutableSetMultimap.Builder<String, PendingDeposit> builder = new ImmutableSetMultimap.Builder<>();
    DateTime now = clock.nowUtc();/*from w w w. j av a  2s.c  om*/
    for (String tld : Registries.getTldsOfType(TldType.REAL)) {
        Registry registry = Registry.get(tld);
        if (!registry.getEscrowEnabled()) {
            continue;
        }
        // Avoid creating a transaction unless absolutely necessary.
        Cursor cursor = ofy().load().key(Cursor.createKey(cursorType, registry)).now();
        DateTime cursorValue = (cursor != null ? cursor.getCursorTime() : startingPoint);
        if (isBeforeOrAt(cursorValue, now)) {
            DateTime watermark = (cursor != null ? cursor.getCursorTime()
                    : transactionallyInitializeCursor(registry, cursorType, startingPoint));
            if (isBeforeOrAt(watermark, now)) {
                builder.put(tld, PendingDeposit.create(tld, watermark, mode, cursorType, interval));
            }
        }
    }
    return builder.build();
}

From source file:io.druid.java.util.http.client.HttpClientConfig.java

License:Apache License

@Deprecated // Use the builder instead
public HttpClientConfig(int numConnections, SSLContext sslContext) {
    this(numConnections, sslContext, Duration.ZERO, null, DEFAULT_BOSS_COUNT, DEFAULT_WORKER_COUNT,
            DEFAULT_COMPRESSION_CODEC, DEFAULT_UNUSED_CONNECTION_TIMEOUT_DURATION);
}