Package com.volantis.shared.time

Examples of com.volantis.shared.time.Period


                    Boolean.toString(webdConfig.getFollowRedirects()));
            requestOperation.setUrlString(remappedURL);
            requestOperation.setRequestType(HTTPRequestType.GET);
            // todo this is wrong as the request operation timeout is in
            // todo seconds but the configuration is in milliseconds.
            Period timeout = Period.treatNonPositiveAsIndefinitely(
                    webdConfig.getTimeoutInMillis());
            requestOperation.setTimeout(timeout);

            // This is necessary in order for the request process to be
            // able to pick up the headers, parameters, cookies etc.
View Full Code Here


            // headers
            final Time expires = cachingDirectives.getExpires();
            if (expires != Time.NEVER) {
                response.addDateHeader("Expires", expires.inMillis());
                // compute max-age value
                final Period timeToLive = cachingDirectives.getTimeToLive();
                long maxAgeInSeconds = 0;
                if (timeToLive != null) {
                    maxAgeInSeconds =
                        LongHelper.asInt(timeToLive.inMillis() / 1000);
                    if (maxAgeInSeconds < 0) {
                        maxAgeInSeconds = 0;
                    }
                }
                response.addHeader("Cache-Control", "max-age=" + maxAgeInSeconds);
View Full Code Here

                        "' timed-out " +
                        "at " + connectionTimeout + "milliseconds.";
                logger.debug(message);
            } else {
                Time now = clock.getCurrentTime();
                Period retrievalDuration = now.getPeriodSince(startTime);
                String message = "Remote request to '" + url +
                        "' retrieval time was " +
                        retrievalDuration + ".";
                logger.debug(message);
            }
View Full Code Here

        // Generate TTL for CSS Cache Entry (in milliseconds)
        final ResponseCachingDirectives cachingDirectives =
            context.getEnvironmentContext().getCachingDirectives();
        long timeToLive = -1;
        if (cachingDirectives != null) {
            final Period ttl = cachingDirectives.getTimeToLive();
            if (ttl != null) {
                timeToLive = ttl.inMillis();
            }
        }

        // Create and store CSS Cache Entry.
        final CacheIdentity identity =
View Full Code Here

            // 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.
View Full Code Here

                getCachingDirectives(context);

        if (cachingDirectives != null) {
            // Determine max-age as Period
            try {
                Period maxage = Period.inSeconds(Long.parseLong(content));

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

    private RemoteReadersFactory createRemoteReadersFactory() {
        RemotePoliciesConfiguration remotePolicies =
                marinerConfig.getRemotePolicies();
        int connectionTimeout = remotePolicies.getRealConnectionTimeout();

        Period timeout = Period.treatZeroAsIndefinitely(connectionTimeout);

        RemoteReadersFactory remoteReadersFactory =
                new RemoteReadersFactoryImpl(timeout,
                        SystemClock.getDefaultInstance());
        return remoteReadersFactory;
View Full Code Here

            final EnvironmentContext environmentContext =
                context.getEnvironmentContext();
            final ResponseCachingDirectives cachingDirectives =
                environmentContext.getCachingDirectives();
            if (cachingDirectives != null && cachingDirectives.isEnabled()) {
                final Period timeToLive =
                    cachingDirectives.getTimeToLive();
               
                // According to HTTp specification we treat "never expires" as "expires in approx. 1 year.
                // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
                final long ttl = ((Period.INDEFINITELY.equals(timeToLive))) ?
                        365 * 24 * 60 * 60 :
                        timeToLive.inSeconds() + SAFETY_THRESHOLD_FOR_MAP_ITEMS;

                mediaAgent.ensureMinTimeToLive(ttl);
            }
        }
    }
View Full Code Here

TOP

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

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.