cmailleux 2005/03/30 10:41:11 CEST
Modified files: (Branch: JAHIA-4-0-BRANCH)
src/java/org/jahia/operations OperationManager.java
Log:
Manage pages with expirationdelay equal to zero as pages with cache off (non
cacheable pages)
Revision Changes Path
1.34.2.7 +13 -5 jahia/src/java/org/jahia/operations/OperationManager.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/operations/OperationManager.java.diff?r1=1.34.2.6&r2=1.34.2.7&f=h
Index: OperationManager.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/operations/Attic/OperationManager.java,v
retrieving revision 1.34.2.6
retrieving revision 1.34.2.7
diff -u -r1.34.2.6 -r1.34.2.7
--- OperationManager.java 7 Mar 2005 14:07:24 -0000 1.34.2.6
+++ OperationManager.java 30 Mar 2005 08:41:10 -0000 1.34.2.7
@@ -63,6 +63,7 @@
private static Map generatingPage = new FastHashMap(3);
// Map containing the entry of the generated page
private static Map generatedPage = new FastHashMap(2503);
+ private static Map notCacheablePage = new FastHashMap(2503);
/** Default constructor, creates a new <code>OperationManager</code>
object instance
*/
public OperationManager () {
@@ -203,6 +204,7 @@
CacheEntry cacheEntry =
htmlCache.getCacheEntry(entryKey);
// This page is cacheable
+ if(jParams.getCacheExpirationDelay()==-1 ||
jParams.getCacheExpirationDelay()>0)
iscacheable = true;
if (cacheEntry != null) {
// logger.debug ("Found HTML page in
cache!!!!!!!!!!!!!!!!!!");
@@ -267,6 +269,10 @@
}
// So we does not found the page in the cache
// check if the page is already generating or is generated
+ // force generation
+ if (!iscacheable || notCacheablePage.containsKey(entryKey))
+ haveToBeenGenerate = true;
+ if(!haveToBeenGenerate) {
synchronized (generatingPage) {
if (!generatingPage.containsKey(entryKey) &&
!generatedPage.containsKey(entryKey) &&
generatingPage.size() < 10) {
@@ -275,10 +281,8 @@
generatedPage.remove(entryKey);
haveToBeenGenerate = true;
}
- // force generation
- if (!iscacheable)
- haveToBeenGenerate = true;
}
+ }
if (haveToBeenGenerate) {
try {
if( logger.isDebugEnabled()) {
@@ -294,7 +298,7 @@
// for JSp
jParams.getRequest().setAttribute("org.jahia.data.JahiaData", jData);
-
+ logger.debug("Start of handling operation");
theEngine.handleActions(jParams, jData);
logger.debug("Operation handled for engine " + engineName);
@@ -316,6 +320,7 @@
} else if(!haveToBeenGenerate && iscacheable) {
try {
Thread.sleep(2000);
+ logger.debug("go to sleep for 2s");
} catch (InterruptedException e) {
logger.error("Exception during sleep ", e);
}
@@ -417,7 +422,8 @@
languageCode,
workflowState,
jParams.getUserAgent ());
-
+ if(jParams.getCacheExpirationDelay()==0)
+ notCacheablePage.put(entryKey,entryKey);
// compute the entry's expiration date
if (jParams.settings ().getOutputCacheDefaultExpirationDelay ()
!= -1) {
Date nowDate = new Date ();
@@ -456,6 +462,8 @@
workflowState,
jParams.getUserAgent ());
generatingPage.remove(entryKey);
+ if(jParams.getCacheExpirationDelay()==0)
+ notCacheablePage.put(entryKey,entryKey);
}
}