Package com.volantis.shared.time

Examples of com.volantis.shared.time.Time


        retainDuringRetry = cacheControl.getRetainDuringRetry();
        retryFailedRetrieval = cacheControl.getRetryFailedRetrieval();
        retryIntervalInMS = Period.inSeconds(cacheControl.getRetryInterval());
        maxRetryCount = cacheControl.getRetryMaxCount();

        Time currentTime = clock.getCurrentTime();
        if (initialPolicy == null) {
            // Calculate the expiration time based on the retry interval. A
            // retry interval of 0 (or less) will result in the policy being
            // retried immediately on the next request.
            expirationTime = currentTime.addPeriod(retryIntervalInMS);

            // The next attempt by the provider to retrieve the object is the
            // first retry.
            retryCount = 1;

        } else {
            Period timeToLive = Period.treatNonPositiveAsIndefinitely(
                    cacheControl.getTimeToLive() * 1000);
            expirationTime = currentTime.addPeriod(timeToLive);

            // No retrievals have failed yet so the next retrieval is not a
            // retry.
            retryCount = 0;
        }
View Full Code Here


     */
    public boolean hasExpired(SystemClock clock) {
        if (expirationTime == Time.NEVER) {
            return false;
        } else {
            Time currentTime = clock.getCurrentTime();
            return Comparator.GE.compare(currentTime, expirationTime);
        }
    }
View Full Code Here

        // allowed.
        if (retryFailedRetrieval && retryCount < maxRetryCount) {

            // Retry is supported so set the expiration time so
            // that this will expire when it needs to retry.
            Time currentTime = clock.getCurrentTime();
            expirationTime = currentTime.addPeriod(retryIntervalInMS);

            // If the previous policy should be retained while retrying
            // then return that instead of null.
            if (retainDuringRetry) {
                policy = expiredPolicy;
View Full Code Here

        final ResponseCachingDirectives rcd =
            new ResponseCachingDirectives(clockMock);

        assertNull(rcd.getExpires());

        final Time expires = time[0].addPeriod(Period.inSeconds(50));
        rcd.setExpires(expires, ResponseCachingDirectives.PRIORITY_NORMAL);
        assertEquals(expires, rcd.getExpires());

        time[0] = time[0].addPeriod(Period.inSeconds(10));
        assertEquals(expires, rcd.getExpires());
View Full Code Here

                    throw new PAPIException(EXCEPTION_LOCALIZER.format(
                            "invalid-meta-content-type", new Object[]{
                            Time.class.getName(), String.class.getName()}));
                }

                Time expires = Time.inMilliSeconds(httpDate.getTime());

                cachingDirectives.setExpires(expires,
                        ResponseCachingDirectives.PRIORITY_HIGH);
                cachingDirectives.enable();
            } catch (NumberFormatException e) {
View Full Code Here

TOP

Related Classes of com.volantis.shared.time.Time

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.