Package com.volantis.shared.dependency

Examples of com.volantis.shared.dependency.Dependency


        DependencyTracker tracker =
                new DependencyTrackerImpl();
        tracker.addDependency(dependency1Mock);
        tracker.addDependency(dependency2Mock);

        Dependency aggregate = tracker.extractDependency();

        Cacheability cacheability = aggregate.getCacheability();
        assertEquals(Cacheability.UNCACHEABLE, cacheability);

        Period timeToLive = aggregate.getTimeToLive();
        assertEquals(Period.inSeconds(100), timeToLive);

        Freshness freshness = aggregate.freshness(contextMock);
        assertEquals(Freshness.REVALIDATE, freshness);

        Freshness revalidate = aggregate.revalidate(contextMock);
        assertEquals(Freshness.FRESH, revalidate);
    }
View Full Code Here


                        // auto mode
                        // check if the dependency is fresh or it can be
                        // revalidated
                        final DependencyContext dependencyContext =
                            getPipelineContext().getDependencyContext();
                        final Dependency dependency = value.getDependency();
                        Freshness freshness =
                            dependency.freshness(dependencyContext);
                        if (freshness == Freshness.REVALIDATE) {
                            freshness =
                                dependency.revalidate(dependencyContext);
                        }

                        // if the dependency is fresh, cache can play the
                        // content back
                        if (freshness == Freshness.FRESH) {
                            // Get the recording from the cache.
                            recording = value.getRecording();
                            this.state =
                                CacheBodyOperationProcessState.PLAYBACK_AND_SUPPRESS;

                            final SystemClock clock =
                                SystemClock.getDefaultInstance();
                            final Time currentTime = clock.getCurrentTime();
                            final PipelineCacheState pcs =
                                new PipelineCacheState(currentTime.addPeriod(
                                    dependency.getTimeToLive()));
                            dependencyContext.addDependency(dependency);

                            // update the cache with the old value so other
                            // threads don't need to wait the timeout period
                            ProviderResult result = new ProviderResult(
View Full Code Here

            // Update the cachable result of this operation.
            final SystemClock clock = SystemClock.getDefaultInstance();
            final DependencyContext dependencyContext =
                getPipelineContext().getDependencyContext();
            dependencyContext.popDependencyTracker();
            final Dependency dependency;
            if (fixedExpiryMode) {
                dependency = new FixedTTLDependency(
                    clock, cacheControl.getTimeToLive());
            } else {
                dependency = dependencyContext.extractDependency();
            }
            dependencyContext.addDependency(dependency);

            // Set the result to cachable based on the inErrorRecoveryMode
            // state.
            final PipelineCacheState pcs = new PipelineCacheState(
                clock.getCurrentTime().addPeriod(dependency.getTimeToLive()));
            final ProviderResult result = new ProviderResult(
                new RecordingWithDependency(recording, dependency),
                getCacheGroup(), !inErrorRecoveryMode, pcs);
            async.update(result);
View Full Code Here

                final XMLPipelineContext pipelineContext =
                    environmentContext.getPipelineContext();
                final DependencyContext dependencyContext =
                    pipelineContext.getDependencyContext();
                if (dependencyContext.isTrackingDependencies()) {
                    final Dependency dependency =
                        dependencyContext.extractDependency();
                    if (dependency.getCacheability() == Cacheability.CACHEABLE) {
                        cachingDirectives.setMaxAge(dependency.getTimeToLive(),
                            ResponseCachingDirectives.PRIORITY_NORMAL);
                        cachingDirectives.enable();
                    } else {
                        cachingDirectives.disable();
                    }
View Full Code Here

TOP

Related Classes of com.volantis.shared.dependency.Dependency

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.