You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2010/04/19 17:22:59 UTC
svn commit: r935622 -
/incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/cachemanager/CacheManager.java
Author: kwright
Date: Mon Apr 19 15:22:58 2010
New Revision: 935622
URL: http://svn.apache.org/viewvc?rev=935622&view=rev
Log:
Fix a cache bug I introduced when abstracting the inter-process communications.
Modified:
incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/cachemanager/CacheManager.java
Modified: incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/cachemanager/CacheManager.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/cachemanager/CacheManager.java?rev=935622&r1=935621&r2=935622&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/cachemanager/CacheManager.java (original)
+++ incubator/lcf/trunk/modules/framework/core/org/apache/lcf/core/cachemanager/CacheManager.java Mon Apr 19 15:22:58 2010
@@ -408,7 +408,10 @@ public class CacheManager implements ICa
Object q = transactionHandle.lookupObject(objectDescription);
if (q != null)
{
- // System.out.println("Found object in transaction cache: "+objectDescription.getCriticalSectionName());
+ if (Logging.cache.isDebugEnabled())
+ {
+ Logging.cache.debug(" Object '"+objectDescription.getCriticalSectionName()+"' found in transaction cache");
+ }
return q;
}
// See if we can look at the parent
@@ -423,6 +426,11 @@ public class CacheManager implements ICa
if (o == null)
return null;
+ if (Logging.cache.isDebugEnabled())
+ {
+ Logging.cache.debug(" Object '"+objectDescription.getCriticalSectionName()+"' exists locally; checking if local copy is valid");
+ }
+
// Before we conclude that the object is found, if we are on a multi-JVM environment we MUST check
// the object's timestamp!!! We check it against the invalidation key file timestamps for the object.
long createTime = cache.getObjectCreationTime(objectDescription);
@@ -442,6 +450,11 @@ public class CacheManager implements ICa
// System.out.println("Found object: "+objectDescription.getCriticalSectionName());
+ if (Logging.cache.isDebugEnabled())
+ {
+ Logging.cache.debug(" Object '"+objectDescription.getCriticalSectionName()+"' is valid; resetting local expiration");
+ }
+
// Update the expiration time for this object.
resetObjectExpiration(objectDescription,handle.getLookupTime());
@@ -457,6 +470,10 @@ public class CacheManager implements ICa
throws LCFException
{
long createdDate = readSharedData(key);
+ if (Logging.cache.isDebugEnabled())
+ {
+ Logging.cache.debug(" Checking whether our cached copy of object with key = "+key+" has been invalidated. It has create time "+new Long(createTime).toString()+", and the last change is "+new Long(createdDate).toString());
+ }
if (createdDate == 0L)
return false;
return createdDate >= createTime;
@@ -619,6 +636,8 @@ public class CacheManager implements ICa
while (iter.hasNext())
{
String keyName = (String)iter.next();
+ if (Logging.cache.isDebugEnabled())
+ Logging.cache.debug(" Invalidating key = "+keyName+" as of time = "+new Long(invalidationTime).toString());
writeSharedData(keyName,invalidationTime);
}
@@ -845,7 +864,7 @@ public class CacheManager implements ICa
{
try
{
- lockManager.writeData(key,Long.toString(value).getBytes("utf-8"));
+ lockManager.writeData("cache-"+key,Long.toString(value).getBytes("utf-8"));
}
catch (UnsupportedEncodingException e)
{