Package com.volantis.shared.time

Examples of com.volantis.shared.time.Period


        }
        return cacheability;
    }

    public Period getTimeToLive() {
        Period min = Period.INDEFINITELY;
        for (int i = 0; i < dependencies.length &&
                Comparator.NE.compare(min, Period.ZERO); i++) {
            Dependency dependency = dependencies[i];
            Period timeToLive = dependency.getTimeToLive();
            min = Period.min(timeToLive, min);
        }

        return min;
    }
View Full Code Here


        ConnectionConfigurationImpl connectionConfiguration =
                (ConnectionConfigurationImpl)
                configuration.retrieveConfiguration(
                        ConnectionConfiguration.class);

        Period timeout = Period.INDEFINITELY;
        if (connectionConfiguration != null) {
            timeout = connectionConfiguration.getTimeoutAsPeriod();
        }

        // get the cache configuration
View Full Code Here

            if ((value = attributes.getValue("ignoreErroredContent")) != null) {
                operation.setIgnoreErroredContent(value);
            }

            // Set the timeout on the operation.
            Period period = determineTimeout(dynamicProcess, attributes);
            operation.setTimeout(period);

        } else {
            forwardError(dynamicProcess, "URL is required. Value is: " + url);
        }
View Full Code Here

    private Period determineTimeout(
            DynamicProcess dynamicProcess,
            Attributes attributes) throws SAXException {

        String value = attributes.getValue("timeout");
        Period timeout = Period.INDEFINITELY;
        if (value != null) {
            int timeoutInSeconds = -1;

            // The attribute should contain an integer number of seconds
            try {
View Full Code Here

public class PipelineCacheStateTestCase extends TestCase {

    public void testLimitedTimeToLive() throws Exception {
        final SystemClock clock = SystemClock.getDefaultInstance();
        final Period period = CacheControlRule.calculateTimeToLive("2");    // 2 seconds

        final PipelineCacheState pcs = new PipelineCacheState(
            clock.getCurrentTime().addPeriod(period));

        assertFalse("Hasn't expired yet", pcs.hasExpired(clock));
View Full Code Here

        Selector selector = Selector.open();
        try {
            SelectionKey key = channel.register(selector,
                    SelectionKey.OP_CONNECT);

            Period timeRemaining = connectionTimeout;
            Time startTime = clock.getCurrentTime();

            boolean connected = false;
            while (!connected) {
                long timeout = timeRemaining.inMillisTreatIndefinitelyAsZero();
                int keys = selector.select(timeout);
                if (keys == 0) {
                    // Selector woken up, check to see whether it has timed out.
                    Time now = clock.getCurrentTime();
                    Period elapsed = now.getPeriodSince(startTime);
                    if (Comparator.GE.compare(
                            elapsed, timeRemaining)) {
                        // Timed out so fail.
                        throw new ConnectException("Timed out");
                    } else {
View Full Code Here

        operation.setId(attributes.getValue(ID_ATTRIBUTE));

        // Handle the timeout setting. Firstly, we need to see if there is a
        // timeout attribute. We default to -1 to indicate no timeout
        String timeoutAttr = attributes.getValue(TIMEOUT_ATTRIBUTE);
        Period timeout = null;

        if (timeoutAttr != null) {
            // The attribute should contain an integer number of seconds
            int timeoutInSecs;
            try {
View Full Code Here

        operation.setEncoding(ENCODING_ATTRIBUTE_VALUE);

        // Handle the timeout setting. Firstly, we need to see if there is a
        // timeout attribute. We default to -1 to indicate no timeout
        String timeoutAttr = TIMEOUT_ATTRIBUTE_VALUE;
        Period timeout = null;

        if (timeoutAttr != null) {
            // The attribute should contain an integer number of seconds
            int timeoutInSecs;
            try {
View Full Code Here

        operation.setEncoding(ENCODING_ATTRIBUTE_VALUE);

        // Handle the timeout setting. Firstly, we need to see if there is a
        // timeout attribute. We default to -1 to indicate no timeout
        String timeoutAttr = TIMEOUT_ATTRIBUTE_VALUE;
        Period timeout = null;

        if (timeoutAttr != null) {
            // The attribute should contain an integer number of seconds
            int timeoutInSecs;
            try {
View Full Code Here

     * @param currentTime the time at which the age is computed
     *
     * @return the age of the HTTP content
     */
    public Period getCurrentAge(final Time currentTime) {
        final Period residentTime = currentTime.getPeriodSince(responseTime);
        return residentTime.add(correctedInitialAge);
    }
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.