org.apache.cocoon.pipeline
Class AsyncCachePipeline<T extends PipelineComponent>

java.lang.Object
  extended by org.apache.cocoon.pipeline.AbstractPipeline<T>
      extended by org.apache.cocoon.pipeline.CachingPipeline<T>
          extended by org.apache.cocoon.pipeline.AsyncCachePipeline<T>
All Implemented Interfaces:
CacheRefreshJob, Pipeline<T>

public class AsyncCachePipeline<T extends PipelineComponent>
extends CachingPipeline<T>
implements CacheRefreshJob

This Pipeline basically works like the CachingPipeline. The only difference is that when the cached result isn't valid anymore, the refresh is done in a separate thread. This means that the re-production of the result doesn't block the initial request. The disadvantage of this approach is that until the result is being reproduced, an out-dated result is returned. If this is out of question for a use case, the CachingPipeline has to be used.


Field Summary
 
Fields inherited from class org.apache.cocoon.pipeline.CachingPipeline
cache, cacheKey, cachingOutputStream
 
Constructor Summary
AsyncCachePipeline()
           
 
Method Summary
 void execute()
          After the pipeline has been setup (Pipeline.setup(OutputStream, Map), this method can be invoked in order to produce the result.
 CacheRefreshManager getCacheRefreshManager()
           
 void refresh(CacheKey cacheKey)
          
 void setCacheRefreshManager(CacheRefreshManager cacheRefreshManager)
           
 
Methods inherited from class org.apache.cocoon.pipeline.CachingPipeline
constructCacheKey, getCachedValue, getCacheKey, getExpires, getLastModified, isCacheKeyValid, setCache, setCachedValue, setConfiguration, setExpires, setExpiresCacheKey, setup
 
Methods inherited from class org.apache.cocoon.pipeline.AbstractPipeline
addComponent, getComponents, getContentType, getFinisher, invokeStarter, setup, setupComponents, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AsyncCachePipeline

public AsyncCachePipeline()
Method Detail

execute

public void execute()
             throws Exception
After the pipeline has been setup (Pipeline.setup(OutputStream, Map), this method can be invoked in order to produce the result.

Specified by:
execute in interface Pipeline<T extends PipelineComponent>
Overrides:
execute in class CachingPipeline<T extends PipelineComponent>
Throws:
Exception - Any problem that might occur while processing the pipeline.
See Also:
CachingPipeline.execute()

getCacheRefreshManager

public CacheRefreshManager getCacheRefreshManager()

refresh

public void refresh(CacheKey cacheKey)

Specified by:
refresh in interface CacheRefreshJob
See Also:
CacheRefreshJob.refresh(org.apache.cocoon.pipeline.caching.CacheKey)

setCacheRefreshManager

public void setCacheRefreshManager(CacheRefreshManager cacheRefreshManager)


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.