[exo-jcr-commits] exo-jcr SVN: r3303 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent: jbosscache and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Oct 20 03:53:13 EDT 2010
Author: dkuleshov
Date: 2010-10-20 03:53:13 -0400 (Wed, 20 Oct 2010)
New Revision: 3303
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
Log:
EXOJCR-965: added disable/enable cache feature support
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-10-19 14:26:53 UTC (rev 3302)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-10-20 07:53:13 UTC (rev 3303)
@@ -18,6 +18,14 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.CountDownLatch;
+
+import javax.jcr.RepositoryException;
+import javax.transaction.TransactionManager;
+
import org.exoplatform.services.jcr.dataflow.ItemStateChangesLog;
import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
import org.exoplatform.services.jcr.datamodel.ItemData;
@@ -33,14 +41,6 @@
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.transaction.TransactionService;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.CountDownLatch;
-
-import javax.jcr.RepositoryException;
-import javax.transaction.TransactionManager;
-
/**
* Created by The eXo Platform SAS.
*
@@ -393,83 +393,97 @@
@Override
public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException
{
-
- // 1. Try from cache
- ItemData data = getCachedItemData(parentData, name, itemType);
-
- // 2. Try from container
- if (data == null)
+ if (cache.isEnabled())
{
- final DataRequest request = new DataRequest(parentData.getIdentifier(), name);
+ // 1. Try from cache
+ ItemData data = getCachedItemData(parentData, name, itemType);
- try
+ // 2. Try from container
+ if (data == null)
{
- request.start();
- // Try first to get the value from the cache since a
- // request could have been launched just before
- data = getCachedItemData(parentData, name, itemType);
- if (data == null)
+ final DataRequest request = new DataRequest(parentData.getIdentifier(), name);
+
+ try
{
- data = getPersistedItemData(parentData, name, itemType);
+ request.start();
+ // Try first to get the value from the cache since a
+ // request could have been launched just before
+ data = getCachedItemData(parentData, name, itemType);
+ if (data == null)
+ {
+ data = getPersistedItemData(parentData, name, itemType);
+ }
+ else if (!data.isNode())
+ {
+ fixPropertyValues((PropertyData)data);
+ }
}
- else if (!data.isNode())
+ finally
{
- fixPropertyValues((PropertyData)data);
+ request.done();
}
}
- finally
+ else if (!data.isNode())
{
- request.done();
+ fixPropertyValues((PropertyData)data);
}
+
+ return data instanceof NullNodeData ? null : data;
}
- else if (!data.isNode())
+ else
{
- fixPropertyValues((PropertyData)data);
+ return super.getItemData(parentData, name, itemType);
}
-
- return data instanceof NullNodeData ? null : data;
}
+
/**
* {@inheritDoc}
*/
@Override
public ItemData getItemData(String identifier) throws RepositoryException
{
- // 1. Try from cache
- ItemData data = getCachedItemData(identifier);
-
- // 2 Try from container
- if (data == null)
+ if (cache.isEnabled())
{
- final DataRequest request = new DataRequest(identifier);
+ // 1. Try from cache
+ ItemData data = getCachedItemData(identifier);
- try
+ // 2 Try from container
+ if (data == null)
{
- request.start();
- // Try first to get the value from the cache since a
- // request could have been launched just before
- data = getCachedItemData(identifier);
- if (data == null)
+ final DataRequest request = new DataRequest(identifier);
+
+ try
{
- data = getPersistedItemData(identifier);
+ request.start();
+ // Try first to get the value from the cache since a
+ // request could have been launched just before
+ data = getCachedItemData(identifier);
+ if (data == null)
+ {
+ data = getPersistedItemData(identifier);
+ }
+ else if (!data.isNode())
+ {
+ fixPropertyValues((PropertyData)data);
+ }
}
- else if (!data.isNode())
+ finally
{
- fixPropertyValues((PropertyData)data);
+ request.done();
}
}
- finally
+ else if (!data.isNode())
{
- request.done();
+ fixPropertyValues((PropertyData)data);
}
+
+ return data instanceof NullNodeData ? null : data;
}
- else if (!data.isNode())
+ else
{
- fixPropertyValues((PropertyData)data);
+ return super.getItemData(identifier);
}
-
- return data instanceof NullNodeData ? null : data;
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-10-19 14:26:53 UTC (rev 3302)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-10-20 07:53:13 UTC (rev 3303)
@@ -18,6 +18,19 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import javax.jcr.RepositoryException;
+import javax.transaction.TransactionManager;
+
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
@@ -48,19 +61,6 @@
import org.jboss.cache.config.EvictionRegionConfig;
import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import javax.jcr.RepositoryException;
-import javax.transaction.TransactionManager;
-
/**
* Created by The eXo Platform SAS.<p/>
*
@@ -98,6 +98,8 @@
private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.JBossCacheWorkspaceStorageCache");
+ private final boolean enabled;
+
public static final String JBOSSCACHE_CONFIG = "jbosscache-configuration";
public static final String JBOSSCACHE_EXPIRATION = "jbosscache-expiration-time";
@@ -283,6 +285,8 @@
throw new RepositoryConfigurationException("Cache configuration not found");
}
+ enabled = wsConfig.getCache().isEnabled();
+
// create cache using custom factory
ExoJBossCacheFactory<Serializable, Object> factory;
@@ -791,7 +795,7 @@
*/
public boolean isEnabled()
{
- return true;
+ return enabled;
}
// non-public members
More information about the exo-jcr-commits
mailing list