exo-jcr SVN: r2237 - kernel/tags.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-04-08 11:44:13 -0400 (Thu, 08 Apr 2010)
New Revision: 2237
Added:
kernel/tags/2.2.1-CR1/
Log:
[maven-scm] copy for tag 2.2.1-CR1
Copied: kernel/tags/2.2.1-CR1 (from rev 2236, kernel/trunk)
14 years, 1 month
exo-jcr SVN: r2236 - in kernel/trunk: exo.kernel.commons and 12 other directories.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-04-08 11:43:44 -0400 (Thu, 08 Apr 2010)
New Revision: 2236
Modified:
kernel/trunk/exo.kernel.commons/pom.xml
kernel/trunk/exo.kernel.component.cache/pom.xml
kernel/trunk/exo.kernel.component.command/pom.xml
kernel/trunk/exo.kernel.component.common/pom.xml
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml
kernel/trunk/exo.kernel.component.remote/pom.xml
kernel/trunk/exo.kernel.container/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml
kernel/trunk/exo.kernel.mc-integration/pom.xml
kernel/trunk/packaging/module/pom.xml
kernel/trunk/pom.xml
Log:
[maven-release-plugin] prepare release 2.2.1-CR1
Modified: kernel/trunk/exo.kernel.commons/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.commons/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/exo.kernel.commons/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<artifactId>exo.kernel.commons</artifactId>
Modified: kernel/trunk/exo.kernel.component.cache/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.cache/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/exo.kernel.component.cache/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<artifactId>exo.kernel.component.cache</artifactId>
Modified: kernel/trunk/exo.kernel.component.command/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.command/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/exo.kernel.component.command/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<artifactId>exo.kernel.component.command</artifactId>
@@ -60,19 +60,19 @@
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/CommandServiceTest.java</exclude>
- <exclude>**/MultiConfigServiceTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/CommandServiceTest.java</exclude>
+ <exclude>**/MultiConfigServiceTest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
-</project>
+</project>
Modified: kernel/trunk/exo.kernel.component.common/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.common/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/exo.kernel.component.common/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<artifactId>exo.kernel.component.common</artifactId>
@@ -89,19 +89,19 @@
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/InitialContextTest.java</exclude>
- <exclude>**/TransactionTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/InitialContextTest.java</exclude>
+ <exclude>**/TransactionTest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -18,15 +18,12 @@
02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-<project
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<artifactId>exo.kernel.component.ext.cache.impl.jboss.v3</artifactId>
<name>eXo Kernel :: Cache Extension :: JBoss Cache Implementation</name>
Modified: kernel/trunk/exo.kernel.component.remote/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.remote/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/exo.kernel.component.remote/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<artifactId>exo.kernel.component.remote</artifactId>
Modified: kernel/trunk/exo.kernel.container/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.container/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/exo.kernel.container/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -7,16 +7,12 @@
this software; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-->
-<project
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<artifactId>exo.kernel.container</artifactId>
<name>eXo Kernel :: Container</name>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<artifactId>exo.kernel.mc-int</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<artifactId>exo.kernel.mc-int-demo</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<artifactId>exo.kernel.mc-int-tests</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<artifactId>exo.kernel.mc-kernel-extras</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/exo.kernel.mc-integration/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<artifactId>mc-integration-parent</artifactId>
Modified: kernel/trunk/packaging/module/pom.xml
===================================================================
--- kernel/trunk/packaging/module/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/packaging/module/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: kernel/trunk/pom.xml
===================================================================
--- kernel/trunk/pom.xml 2010-04-08 15:37:28 UTC (rev 2235)
+++ kernel/trunk/pom.xml 2010-04-08 15:43:44 UTC (rev 2236)
@@ -25,12 +25,12 @@
<parent>
<groupId>org.exoplatform</groupId>
<artifactId>foundation-parent</artifactId>
- <version>6-SNAPSHOT</version>
+ <version>6</version>
</parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.1-GA-SNAPSHOT</version>
+ <version>2.2.1-CR1</version>
<packaging>pom</packaging>
<name>eXo Kernel</name>
@@ -38,14 +38,14 @@
<properties>
<exo.product.name>exo-kernel</exo.product.name>
<exo.product.specification>2.2</exo.product.specification>
- <org.exoplatform.framework.junit.version>1.2.2-GA-SNAPSHOT</org.exoplatform.framework.junit.version>
+ <org.exoplatform.framework.junit.version>1.2.1-GA</org.exoplatform.framework.junit.version>
<forkMode>always</forkMode>
</properties>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/kernel/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/exo-jcr/kernel/trunk</developerConnection>
- <url>http://fisheye.jboss.org/browse/exo-jcr/kernel/trunk</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/kernel/tags/2.2.1-CR1</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/exo-jcr/kernel/tags/2.2.1-CR1</developerConnection>
+ <url>http://fisheye.jboss.org/browse/exo-jcr/kernel/tags/2.2.1-CR1</url>
</scm>
<modules>
14 years, 1 month
exo-jcr SVN: r2234 - parent/tags.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-04-08 11:37:19 -0400 (Thu, 08 Apr 2010)
New Revision: 2234
Added:
parent/tags/6/
Log:
[maven-scm] copy for tag 6
Copied: parent/tags/6 (from rev 2233, parent/trunk)
14 years, 1 month
exo-jcr SVN: r2232 - in jcr/trunk/exo.jcr.component.core/src: main/resources/conf/portal and 4 other directories.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-04-08 11:25:14 -0400 (Thu, 08 Apr 2010)
New Revision: 2232
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java
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/resources/conf/portal/jbosscache-data.xml
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestOrderBefore.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml
Log:
EXOJCR-545: Reverting all changes made from 2219 to 2231 back. So actually repository's rev. is 2218.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2010-04-08 15:25:14 UTC (rev 2232)
@@ -18,14 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
-import java.io.Serializable;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.transaction.TransactionManager;
-
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jboss.cache.Cache;
@@ -38,10 +30,17 @@
import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.Region;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jgroups.Address;
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.transaction.TransactionManager;
+
/**
* Decorator over the JBossCache that stores changes in buffer, then sorts and applies to JBossCache.
*
@@ -52,6 +51,8 @@
@SuppressWarnings("unchecked")
public class BufferedJBossCache implements Cache<Serializable, Object>
{
+ // private final Log log = ExoLogger.getLogger("exo.jcr.component.core.BufferedJbossCache");
+
/**
* Parent cache.
*/
@@ -60,20 +61,14 @@
private final ThreadLocal<CompressedChangesBuffer> changesList = new ThreadLocal<CompressedChangesBuffer>();
private ThreadLocal<Boolean> local = new ThreadLocal<Boolean>();
-
- private final boolean useExpiration;
-
- private final long expirationTimeOut;
protected static final Log LOG =
ExoLogger.getLogger("org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache");
- public BufferedJBossCache(Cache<Serializable, Object> parentCache, boolean useExpiration, long expirationTimeOut)
+ public BufferedJBossCache(Cache<Serializable, Object> parentCache)
{
super();
this.parentCache = parentCache;
- this.useExpiration = useExpiration;
- this.expirationTimeOut = expirationTimeOut;
}
/**
@@ -456,7 +451,7 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new PutObjectContainer(fqn, data, parentCache, changesContainer.getHistoryIndex(), local
- .get(), useExpiration, expirationTimeOut));
+ .get()));
}
/* (non-Javadoc)
@@ -466,7 +461,7 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get(), useExpiration, expirationTimeOut));
+ local.get()));
return parentCache.get(fqn, key);
}
@@ -479,7 +474,7 @@
Object prevObject = getObjectFromChangesContainer(changesContainer, fqn, key);
changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get(), useExpiration, expirationTimeOut));
+ local.get()));
if (prevObject != null)
{
@@ -542,7 +537,7 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new RemoveKeyContainer(fqn, key, parentCache, changesContainer.getHistoryIndex(), local
- .get(), useExpiration, expirationTimeOut));
+ .get()));
return parentCache.get(fqn, key);
}
@@ -584,8 +579,7 @@
public boolean removeNode(Fqn fqn)
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
- changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.getHistoryIndex(), local.get(),
- useExpiration, expirationTimeOut));
+ changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.getHistoryIndex(), local.get()));
return true;
}
@@ -654,7 +648,7 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new AddToListContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
- local.get(), useExpiration, expirationTimeOut));
+ local.get()));
}
/**
@@ -668,7 +662,7 @@
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new RemoveFromListContainer(fqn, key, value, parentCache,
- changesContainer.getHistoryIndex(), local.get(), useExpiration, expirationTimeOut));
+ changesContainer.getHistoryIndex(), local.get()));
}
public static enum ChangesType {
@@ -690,12 +684,8 @@
protected final boolean localMode;
- protected final boolean useExpiration;
-
- protected final long timeOut;
-
public ChangesContainer(Fqn fqn, ChangesType changesType, Cache<Serializable, Object> cache, int historicalIndex,
- boolean localMode, boolean useExpiration, long timeOut)
+ boolean localMode)
{
super();
this.fqn = fqn;
@@ -703,8 +693,6 @@
this.cache = cache;
this.historicalIndex = historicalIndex;
this.localMode = localMode;
- this.useExpiration = useExpiration;
- this.timeOut = timeOut;
}
/**
@@ -750,12 +738,6 @@
{
cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(localMode);
}
-
- public final void putExpiration(Fqn efqn)
- {
- setCacheLocalMode();
- cache.put(efqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
- }
public abstract void apply();
}
@@ -768,9 +750,9 @@
private final Map<? extends Serializable, ? extends Object> data;
public PutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
- Cache<Serializable, Object> cache, int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+ Cache<Serializable, Object> cache, int historicalIndex, boolean local)
{
- super(fqn, ChangesType.PUT, cache, historicalIndex, local, useExpiration, timeOut);
+ super(fqn, ChangesType.PUT, cache, historicalIndex, local);
this.data = data;
}
@@ -780,11 +762,6 @@
{
setCacheLocalMode();
cache.put(fqn, data);
-
- if (useExpiration)
- {
- putExpiration(fqn);
- }
}
}
@@ -798,9 +775,9 @@
private final Object value;
public PutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+ int historicalIndex, boolean local)
{
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local);
this.key = key;
this.value = value;
}
@@ -808,11 +785,6 @@
@Override
public void apply()
{
- if (useExpiration)
- {
- putExpiration(fqn);
- }
-
setCacheLocalMode();
cache.put(fqn, key, value);
}
@@ -829,9 +801,9 @@
private final Object value;
public AddToListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+ int historicalIndex, boolean local)
{
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local);
this.key = key;
this.value = value;
}
@@ -853,12 +825,6 @@
newSet.addAll((Set<Object>)existingObject);
}
newSet.add(value);
-
- if (useExpiration)
- {
- putExpiration(fqn);
- }
-
setCacheLocalMode();
cache.put(fqn, key, newSet);
}
@@ -880,9 +846,9 @@
private final Object value;
public RemoveFromListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+ int historicalIndex, boolean local)
{
- super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local);
this.key = key;
this.value = value;
}
@@ -900,12 +866,6 @@
{
Set<Object> newSet = new HashSet<Object>((Set<Object>)existingObject);
newSet.remove(value);
-
- if (useExpiration)
- {
- putExpiration(fqn);
- }
-
setCacheLocalMode();
cache.put(fqn, key, newSet);
}
@@ -920,9 +880,9 @@
private final Serializable key;
public RemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache, int historicalIndex,
- boolean local, boolean useExpiration, long timeOut)
+ boolean local)
{
- super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local);
this.key = key;
}
@@ -941,10 +901,9 @@
public static class RemoveNodeContainer extends ChangesContainer
{
- public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local,
- boolean useExpiration, long timeOut)
+ public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local)
{
- super(fqn, ChangesType.REMOVE, cache, historicalIndex, local, useExpiration, timeOut);
+ super(fqn, ChangesType.REMOVE, cache, historicalIndex, local);
}
@Override
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java 2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java 2010-04-08 15:25:14 UTC (rev 2232)
@@ -18,16 +18,16 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesType;
+import org.jboss.cache.Fqn;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesType;
-import org.jboss.cache.Fqn;
-
/**
* Sorting cache modification "as is" in {@link BufferedJBossCache} may harm data consistency.
* Here is a link, showing possible trouble:
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-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-04-08 15:25:14 UTC (rev 2232)
@@ -38,11 +38,8 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.transaction.TransactionService;
-import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
-import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
import java.io.Serializable;
import java.util.ArrayList;
@@ -68,24 +65,24 @@
* <ul>
* <li>/$ITEMS - stores items by Id (i.e. /$ITEMS/itemId)</li>
* <li>/$CHILD_NODES, /$CHILD_PROPS - stores items by parentId and name (i.e. /$CHILD_NODES/parentId/childName.$ITEM_ID)</li>
- * <li>/$CHILD_NODES_LIST, /$CHILD_PROPS_LIST - stores child list by parentId and child Id
+ * <li>/$CHILD_NODES_LIST, /$CHILD_PROPS_LIST - stores child list by parentId and child Id
* (i.e. /$CHILD_NODES_LIST/parentId.lists = serialized Set<Object>)</li>
* </ul>
- * </li>
+ * </li>
* <li>all child properties/nodes lists should be evicted from parent at same time
* i.e. for /$CHILD_NODES_LIST, /$CHILD_PROPS_LIST we need customized eviction policy (EvictionActionPolicy) to evict
* whole list on one of childs eviction
- * </li>
+ * </li>
* </ul>
*
- * <p/>
- * Current state notes (subject of change):
+ * <p/>
+ * Current state notes (subject of change):
* <ul>
* <li>cache implements WorkspaceStorageCache, without any stuff about references and locks</li>
* <li>transaction style implemented via JBC barches, do with JTA (i.e. via exo's TransactionService + JBoss TM)</li>
* <li>we need customized eviction policy (EvictionActionPolicy) for /$CHILD_NODES_LIST, /$CHILD_PROPS_LIST</li>
* </ul>
- *
+ *
* @author <a href="mailto:peter.nedonosko@exoplatform.com">Peter Nedonosko</a>
* @version $Id: JBossCacheWorkspaceStorageCache.java 13869 2008-05-05 08:40:10Z pnedonosko $
*/
@@ -96,10 +93,6 @@
public static final String JBOSSCACHE_CONFIG = "jbosscache-configuration";
- public static final String JBOSSCACHE_EXPIRATION = "jbosscache-expiration-time";
-
- public static final int JBOSSCACHE_EXPIRATION_DEFAULT = 900000; // 15 minutes
-
public static final String ITEMS = "$ITEMS".intern();
public static final String CHILD_NODES = "$CHILD_NODES".intern();
@@ -260,7 +253,7 @@
*/
public JBossCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, TransactionService transactionService,
ConfigurationManager cfm) throws RepositoryException, RepositoryConfigurationException
- {
+ {
if (wsConfig.getCache() == null)
{
throw new RepositoryConfigurationException("Cache configuration not found");
@@ -278,37 +271,8 @@
factory = new ExoJBossCacheFactory<Serializable, Object>(cfm);
}
- // create parent JBossCache instance
- Cache<Serializable, Object> parentCache = factory.createCache(wsConfig.getCache());
- // get all eviction configurations
- List<EvictionRegionConfig> evictionConfigurations =
- parentCache.getConfiguration().getEvictionConfig().getEvictionRegionConfigs();
- // append and default eviction configuration, since it is not present in region configurations
- evictionConfigurations.add(parentCache.getConfiguration().getEvictionConfig().getDefaultEvictionRegionConfig());
+ this.cache = new BufferedJBossCache(factory.createCache(wsConfig.getCache()));
- boolean useExpiration = false;
- // looking over all eviction configurations till the end or till some expiration algorithm subclass not found.
- for (EvictionRegionConfig evictionRegionConfig : evictionConfigurations)
- {
- if (evictionRegionConfig.getEvictionAlgorithmConfig() instanceof ExpirationAlgorithmConfig)
- {
- // force set expiration key to default value in all Expiration configurations (if any)
- ((ExpirationAlgorithmConfig)evictionRegionConfig.getEvictionAlgorithmConfig())
- .setExpirationKeyName(ExpirationAlgorithmConfig.EXPIRATION_KEY);
- useExpiration = true;
- }
- }
-
- if (useExpiration)
- {
- LOG.info("Using BufferedJBossCache compatible with Expiration algorithm.");
- }
-
- // if expiration is used, set appropriate factory with with timeout set via configuration (or default one 15minutes)
- this.cache =
- new BufferedJBossCache(factory.createCache(wsConfig.getCache()), useExpiration,
- wsConfig.getCache().getParameterInteger(JBOSSCACHE_EXPIRATION, JBOSSCACHE_EXPIRATION_DEFAULT));
-
this.itemsRoot = Fqn.fromElements(ITEMS);
this.childNodes = Fqn.fromElements(CHILD_NODES);
this.childProps = Fqn.fromElements(CHILD_PROPS);
@@ -323,17 +287,17 @@
createResidentNode(childProps);
createResidentNode(childPropsList);
createResidentNode(itemsRoot);
- }
+ }
/**
* Cache constructor with JBossCache JTA transaction support.
*
- * @param wsConfig WorkspaceEntry workspace config
+ * @param wsConfig WorkspaceEntry workspace config
* @throws RepositoryException if error of initialization
* @throws RepositoryConfigurationException if error of configuration
*/
public JBossCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, ConfigurationManager cfm)
- throws RepositoryException, RepositoryConfigurationException
+ throws RepositoryException, RepositoryConfigurationException
{
this(wsConfig, null, cfm);
}
@@ -372,7 +336,7 @@
/**
* Return TransactionManager used by JBossCache backing the JCR cache.
*
- * @return TransactionManager
+ * @return TransactionManager
*/
public TransactionManager getTransactionManager()
{
@@ -442,8 +406,8 @@
{
if (state.isPersisted())
{
- // There was a problem with removing a list of samename siblings in on transaction,
- // so putItemInBufferedCache(..) and updateInBufferedCache(..) used instead put(..) and update (..) methods.
+ // There was a problem with removing a list of samename siblings in on transaction,
+ // so putItemInBufferedCache(..) and updateInBufferedCache(..) used instead put(..) and update (..) methods.
ItemData prevItem = putItemInBufferedCache(state.getData());
if (prevItem != null && state.isNode())
{
@@ -482,8 +446,8 @@
}
/**
- * {@inheritDoc}
- */
+ * {@inheritDoc}
+ */
public void addChildNodes(NodeData parent, List<NodeData> childs)
{
boolean inTransaction = cache.isTransactionActive();
@@ -577,7 +541,7 @@
// {
// cache.beginTransaction();
// cache.setLocal(true);
- //
+ //
// }
// finally
// {
@@ -668,7 +632,7 @@
/**
* Internal get child properties.
*
- * @param parentId String
+ * @param parentId String
* @param withValue boolean, if true only "full" Propeties can be returned
* @return List of PropertyData
*/
@@ -813,7 +777,7 @@
{
// add in CHILD_NODES
cache.put(makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
- .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
+ .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childNodesList, node
.getParentIdentifier())) != null)
@@ -834,7 +798,7 @@
{
// add in CHILD_NODES
cache.put(makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
- .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
+ .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childNodesList, node
.getParentIdentifier())) != null)
@@ -858,7 +822,7 @@
{
// add in CHILD_PROPS
cache.put(makeChildFqn(childProps, prop.getParentIdentifier(), prop.getQPath().getEntries()[prop.getQPath()
- .getEntries().length - 1]), ITEM_ID, prop.getIdentifier());
+ .getEntries().length - 1]), ITEM_ID, prop.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childPropsList, prop
.getParentIdentifier())) != null)
@@ -880,7 +844,7 @@
// remove from CHILD_NODES of parent
cache.removeNode(makeChildFqn(childNodes, item.getParentIdentifier(), item.getQPath().getEntries()[item
- .getQPath().getEntries().length - 1]));
+ .getQPath().getEntries().length - 1]));
// remove from CHILD_NODES_LIST of parent
cache.removeFromList(makeChildListFqn(childNodesList, item.getParentIdentifier()), ITEM_LIST, item
@@ -903,7 +867,7 @@
{
// remove from CHILD_PROPS
cache.removeNode(makeChildFqn(childProps, item.getParentIdentifier(), item.getQPath().getEntries()[item
- .getQPath().getEntries().length - 1]));
+ .getQPath().getEntries().length - 1]));
// remove from CHILD_PROPS_LIST
cache.removeFromList(makeChildListFqn(childPropsList, item.getParentIdentifier()), ITEM_LIST, item
@@ -936,7 +900,7 @@
}
/**
- * Update Node hierachy in case of same-name siblings reorder.
+ * Update Node hierachy in case of same-name siblings reorder.
* Assumes the new (updated) nodes already putted in the cache. Previous name of updated nodes will be calculated
* and that node will be deleted (if has same id as the new node). Childs paths will be updated to a new node path.
*
@@ -948,7 +912,7 @@
// get previously cached NodeData and using its name remove child on the parent
Fqn<String> prevFqn =
makeChildFqn(childNodes, node.getParentIdentifier(), prevNode.getQPath().getEntries()[prevNode.getQPath()
- .getEntries().length - 1]);
+ .getEntries().length - 1]);
if (node.getIdentifier().equals(cache.get(prevFqn, ITEM_ID)))
{
// it's same-name siblings re-ordering, delete previous child
@@ -978,7 +942,7 @@
// get previously cached NodeData and using its name remove child on the parent
Fqn<String> prevFqn =
makeChildFqn(childNodes, node.getParentIdentifier(), prevNode.getQPath().getEntries()[prevNode.getQPath()
- .getEntries().length - 1]);
+ .getEntries().length - 1]);
if (node.getIdentifier().equals(cache.getFromBuffer(prevFqn, ITEM_ID)))
{
// it's same-name siblings re-ordering, delete previous child
@@ -1014,15 +978,15 @@
PropertyData prevProp = iter.next();
if (inheritACL
- && (prevProp.getQPath().getName().equals(Constants.EXO_PERMISSIONS) || prevProp.getQPath().getName()
- .equals(Constants.EXO_OWNER)))
+ && (prevProp.getQPath().getName().equals(Constants.EXO_PERMISSIONS) || prevProp.getQPath().getName()
+ .equals(Constants.EXO_OWNER)))
{
inheritACL = false;
}
// recreate with new path for child Props only
QPath newPath =
QPath
- .makeChildPath(rootPath, prevProp.getQPath().getEntries()[prevProp.getQPath().getEntries().length - 1]);
+ .makeChildPath(rootPath, prevProp.getQPath().getEntries()[prevProp.getQPath().getEntries().length - 1]);
TransientPropertyData newProp =
new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(), prevProp
.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
@@ -1036,7 +1000,7 @@
// recreate with new path for child Nodes only
QPath newPath =
QPath
- .makeChildPath(rootPath, prevNode.getQPath().getEntries()[prevNode.getQPath().getEntries().length - 1]);
+ .makeChildPath(rootPath, prevNode.getQPath().getEntries()[prevNode.getQPath().getEntries().length - 1]);
TransientNodeData newNode =
new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(), prevNode
.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
@@ -1071,7 +1035,7 @@
TransientNodeData newNode =
new TransientNodeData(prevNode.getQPath(), prevNode.getIdentifier(), prevNode.getPersistedVersion(),
prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
- .getParentIdentifier(), acl);
+ .getParentIdentifier(), acl);
// update this node
cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
// update childs recursive
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml 2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml 2010-04-08 15:25:14 UTC (rev 2232)
@@ -12,11 +12,11 @@
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
+ <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy"
eventQueueSize="1000000">
<property name="maxNodes" value="1000000" />
- <property name="warnNoExpirationKey" value="false" />
+ <property name="timeToLive" value="120000" />
</default>
</eviction>
</jbosscache>
\ No newline at end of file
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestOrderBefore.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestOrderBefore.java 2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestOrderBefore.java 2010-04-08 15:25:14 UTC (rev 2232)
@@ -19,7 +19,6 @@
package org.exoplatform.services.jcr.api.writing;
import org.exoplatform.services.jcr.JcrAPIBaseTest;
-import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.jcr.impl.util.EntityCollection;
import java.util.ArrayList;
@@ -976,14 +975,10 @@
session = repository.login(credentials, "ws");
Node a = session.getRootNode().getNode("a"); // We suppose it already exist
- NodeImpl n1 = (NodeImpl)a.addNode("n");
- NodeImpl n2 = (NodeImpl)a.addNode("n");
- NodeImpl n3 = (NodeImpl)a.addNode("n");
- NodeImpl n4 = (NodeImpl)a.addNode("n");
- NodeImpl n5 = (NodeImpl)a.addNode("n");
- NodeImpl n6 = (NodeImpl)a.addNode("n");
- NodeImpl n7 = (NodeImpl)a.addNode("n");
-
+ a.addNode("n");
+ a.addNode("n");
+ a.addNode("n");
+ a.addNode("n");
session.save();
session.logout();
@@ -993,30 +988,14 @@
i.nextNode().remove();
i.nextNode().remove();
i.nextNode().remove();
- i.nextNode().remove();
- i.nextNode().remove();
- i.nextNode().remove();
session.save();
session.logout();
session = repository.login(credentials, "ws");
-
- NodeImpl n = (NodeImpl)a.getNode("n");
- assertEquals(n7.getData().getIdentifier(), n.getData().getIdentifier());
-
- n = (NodeImpl)a.getNode("n[1]");
- assertEquals(n7.getData().getIdentifier(), n.getData().getIdentifier());
-
a = session.getRootNode().getNode("a");
- NodeImpl nOrd = (NodeImpl)a.addNode("n");
+ a.addNode("n");
a.orderBefore("n", null); // NPE happens here
session.save();
-
- n = (NodeImpl)a.getNode("n[1]");
- assertEquals(n7.getData().getIdentifier(), n.getData().getIdentifier());
-
- n = (NodeImpl)a.getNode("n[2]");
- assertEquals(nOrd.getData().getIdentifier(), n.getData().getIdentifier());
}
public void testDeleteOrderBefore_SNS() throws Exception
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java 2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java 2010-04-08 15:25:14 UTC (rev 2232)
@@ -18,8 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
-import java.util.HashMap;
-
import junit.framework.TestCase;
import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
@@ -27,6 +25,8 @@
import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.RemoveNodeContainer;
import org.jboss.cache.Fqn;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:foo@bar.org">Foo Bar</a>
* @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z aheritier $
@@ -40,13 +40,13 @@
CompressedChangesBuffer buffer = new CompressedChangesBuffer();
ChangesContainer put1 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
ChangesContainer put2 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
ChangesContainer rm1 =
new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"), null, buffer
- .getHistoryIndex(), false, false, 0);
+ .getHistoryIndex(), false);
buffer.add(put1);
buffer.add(put2);
assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
@@ -67,17 +67,17 @@
CompressedChangesBuffer buffer = new CompressedChangesBuffer();
ChangesContainer put1 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
ChangesContainer put2 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
ChangesContainer rm1 =
new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"), null,
- buffer.getHistoryIndex(), false, false, 0);
+ buffer.getHistoryIndex(), false);
ChangesContainer rm2 =
new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"), null, buffer
- .getHistoryIndex(), false, false, 0);
+ .getHistoryIndex(), false);
buffer.add(put1);
buffer.add(put2);
assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
@@ -97,11 +97,11 @@
CompressedChangesBuffer buffer = new CompressedChangesBuffer();
ChangesContainer put1 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST + "/b"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
ChangesContainer rm1 =
new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST + "/b"), null,
- buffer.getHistoryIndex(), false, false, 0);
+ buffer.getHistoryIndex(), false);
buffer.add(put1);
assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
buffer.add(rm1);
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data.xml 2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-data.xml 2010-04-08 15:25:14 UTC (rev 2232)
@@ -12,11 +12,11 @@
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
+ <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy"
eventQueueSize="1000000">
<property name="maxNodes" value="1000000" />
- <property name="warnNoExpirationKey" value="false" />
+ <property name="timeToLive" value="120000" />
</default>
</eviction>
</jbosscache>
\ No newline at end of file
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml 2010-04-08 13:32:12 UTC (rev 2231)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml 2010-04-08 15:25:14 UTC (rev 2232)
@@ -11,11 +11,9 @@
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
- actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy"
- eventQueueSize="1000000">
- <property name="maxNodes" value="50000" />
- <property name="warnNoExpirationKey" value="false" />
+ <default algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy" eventQueueSize="1000000">
+ <property name="maxNodes" value="5000" />
+ <property name="minTimeToLive" value="60000" />
</default>
</eviction>
14 years, 1 month
exo-jcr SVN: r2231 - jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-04-08 09:32:12 -0400 (Thu, 08 Apr 2010)
New Revision: 2231
Modified:
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml
Log:
EXOJCR-545 : The configuration was changed
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml 2010-04-08 12:45:57 UTC (rev 2230)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/jbosscache-data.xml 2010-04-08 13:32:12 UTC (rev 2231)
@@ -12,11 +12,11 @@
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
+ <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy"
eventQueueSize="1000000">
<property name="maxNodes" value="1000000" />
- <property name="timeToLive" value="120000" />
+ <property name="warnNoExpirationKey" value="false" />
</default>
</eviction>
</jbosscache>
\ No newline at end of file
14 years, 1 month
exo-jcr SVN: r2230 - in jcr/trunk/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache and 1 other directory.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-04-08 08:45:57 -0400 (Thu, 08 Apr 2010)
New Revision: 2230
Removed:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChangesContainerExpirationFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChangesContainerFactory.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java
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/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java
Log:
EXOJCR-545 : The implemetation use ExpirationAlgorithm was changed.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2010-04-08 12:42:09 UTC (rev 2229)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2010-04-08 12:45:57 UTC (rev 2230)
@@ -18,8 +18,14 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChangesContainerFactory.ChangesContainer;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChangesContainerFactory.PutKeyValueContainer;
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.transaction.TransactionManager;
+
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jboss.cache.Cache;
@@ -32,19 +38,10 @@
import org.jboss.cache.NodeNotExistsException;
import org.jboss.cache.Region;
import org.jboss.cache.config.Configuration;
+import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jgroups.Address;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.transaction.TransactionManager;
-
/**
* Decorator over the JBossCache that stores changes in buffer, then sorts and applies to JBossCache.
*
@@ -60,34 +57,23 @@
*/
private final Cache<Serializable, Object> parentCache;
- private final ChangesContainerFactory changesContatinerFactory;
-
private final ThreadLocal<CompressedChangesBuffer> changesList = new ThreadLocal<CompressedChangesBuffer>();
- /**
- * This comparator sorts CahangesContainer collection in descending mode.
- */
- private final Comparator<ChangesContainer> changesComparator = new Comparator<ChangesContainer>()
- {
-
- public int compare(ChangesContainer o1, ChangesContainer o2)
- {
- int result = o1.getFqn().compareTo(o2.getFqn());
- return result == 0 ? o2.getHistoricalIndex() - o1.getHistoricalIndex() : result;
- }
-
- };
-
private ThreadLocal<Boolean> local = new ThreadLocal<Boolean>();
+
+ private final boolean useExpiration;
+
+ private final long expirationTimeOut;
protected static final Log LOG =
ExoLogger.getLogger("org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache");
- public BufferedJBossCache(Cache<Serializable, Object> parentCache, ChangesContainerFactory changesContatinerFactory)
+ public BufferedJBossCache(Cache<Serializable, Object> parentCache, boolean useExpiration, long expirationTimeOut)
{
super();
this.parentCache = parentCache;
- this.changesContatinerFactory = changesContatinerFactory;
+ this.useExpiration = useExpiration;
+ this.expirationTimeOut = expirationTimeOut;
}
/**
@@ -469,8 +455,8 @@
public void put(Fqn fqn, Map<? extends Serializable, ? extends Object> data)
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
- changesContainer.add(changesContatinerFactory.createPutObjectContainer(fqn, data, parentCache, changesContainer
- .getHistoryIndex(), local.get()));
+ changesContainer.add(new PutObjectContainer(fqn, data, parentCache, changesContainer.getHistoryIndex(), local
+ .get(), useExpiration, expirationTimeOut));
}
/* (non-Javadoc)
@@ -479,8 +465,8 @@
public Object put(Fqn fqn, Serializable key, Object value)
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
- changesContainer.add(changesContatinerFactory.createPutKeyValueContainer(fqn, key, value, parentCache,
- changesContainer.getHistoryIndex(), local.get()));
+ changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
+ local.get(), useExpiration, expirationTimeOut));
return parentCache.get(fqn, key);
}
@@ -492,8 +478,8 @@
// take Object from buffer for first
Object prevObject = getObjectFromChangesContainer(changesContainer, fqn, key);
- changesContainer.add(changesContatinerFactory.createPutKeyValueContainer(fqn, key, value, parentCache,
- changesContainer.getHistoryIndex(), local.get()));
+ changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
+ local.get(), useExpiration, expirationTimeOut));
if (prevObject != null)
{
@@ -507,42 +493,9 @@
private Object getObjectFromChangesContainer(CompressedChangesBuffer changesContainer, Fqn fqn, Serializable key)
{
- // List<ChangesContainer> changes = changesContainer.getSortedList();
- // Object object = null;
- // for (ChangesContainer change : changes)
- // {
- // if (change.getChangesType().equals(ChangesType.PUT_KEY) && change.getFqn().equals(fqn))
- // {
- // PutKeyValueContainer cont = ((PutKeyValueContainer)change);
- // if (cont.getKey().equals(key))
- // {
- // object = ((PutKeyValueContainer)change).getValue();
- // }
- // }
- // }
- //
- // return object;
-
- List<ChangesContainer> changesContainers = new ArrayList<ChangesContainer>();
- String parentCacheNode = (String)fqn.get(0);
- if (JBossCacheWorkspaceStorageCache.CHILD_NODES.equals(parentCacheNode) && fqn.size() > 1)
- {
- changesContainers.addAll(changesContainer.childNodesMap.get(fqn.get(1)));
- }
- else if (JBossCacheWorkspaceStorageCache.CHILD_PROPS.equals(parentCacheNode) && fqn.size() > 1)
- {
- changesContainers.addAll(changesContainer.childPropertyMap.get(fqn.get(1)));
- }
- else
- {
- changesContainers.addAll(changesContainer.changes);
- }
-
- // sort changes in descending mode
- Collections.sort(changesContainers, changesComparator);
-
+ List<ChangesContainer> changes = changesContainer.getSortedList();
Object object = null;
- for (ChangesContainer change : changesContainers)
+ for (ChangesContainer change : changes)
{
if (change.getChangesType().equals(ChangesType.PUT_KEY) && change.getFqn().equals(fqn))
{
@@ -550,7 +503,6 @@
if (cont.key.equals(key))
{
object = ((PutKeyValueContainer)change).value;
- break;
}
}
}
@@ -589,8 +541,8 @@
public Object remove(Fqn fqn, Serializable key)
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
- changesContainer.add(changesContatinerFactory.createRemoveKeyContainer(fqn, key, parentCache, changesContainer
- .getHistoryIndex(), local.get()));
+ changesContainer.add(new RemoveKeyContainer(fqn, key, parentCache, changesContainer.getHistoryIndex(), local
+ .get(), useExpiration, expirationTimeOut));
return parentCache.get(fqn, key);
}
@@ -632,8 +584,8 @@
public boolean removeNode(Fqn fqn)
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
- changesContainer.add(changesContatinerFactory.createRemoveNodeContainer(fqn, parentCache, changesContainer
- .getHistoryIndex(), local.get()));
+ changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.getHistoryIndex(), local.get(),
+ useExpiration, expirationTimeOut));
return true;
}
@@ -701,8 +653,8 @@
public void addToList(Fqn fqn, String key, Object value)
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
- changesContainer.add(changesContatinerFactory.createAddToListContainer(fqn, key, value, parentCache,
- changesContainer.getHistoryIndex(), local.get()));
+ changesContainer.add(new AddToListContainer(fqn, key, value, parentCache, changesContainer.getHistoryIndex(),
+ local.get(), useExpiration, expirationTimeOut));
}
/**
@@ -715,12 +667,291 @@
public void removeFromList(Fqn fqn, String key, Object value)
{
CompressedChangesBuffer changesContainer = getChangesBufferSafe();
- changesContainer.add(changesContatinerFactory.createRemoveFromListContainer(fqn, key, value, parentCache,
- changesContainer.getHistoryIndex(), local.get()));
+ changesContainer.add(new RemoveFromListContainer(fqn, key, value, parentCache,
+ changesContainer.getHistoryIndex(), local.get(), useExpiration, expirationTimeOut));
}
public static enum ChangesType {
REMOVE, REMOVE_KEY, PUT, PUT_KEY, PUT_TO_LIST;
}
+ /**
+ * Container for changes
+ */
+ public static abstract class ChangesContainer implements Comparable<ChangesContainer>
+ {
+ protected final Fqn fqn;
+
+ protected final ChangesType changesType;
+
+ protected final Cache<Serializable, Object> cache;
+
+ protected final int historicalIndex;
+
+ protected final boolean localMode;
+
+ protected final boolean useExpiration;
+
+ protected final long timeOut;
+
+ public ChangesContainer(Fqn fqn, ChangesType changesType, Cache<Serializable, Object> cache, int historicalIndex,
+ boolean localMode, boolean useExpiration, long timeOut)
+ {
+ super();
+ this.fqn = fqn;
+ this.changesType = changesType;
+ this.cache = cache;
+ this.historicalIndex = historicalIndex;
+ this.localMode = localMode;
+ this.useExpiration = useExpiration;
+ this.timeOut = timeOut;
+ }
+
+ /**
+ * @return the fqn
+ */
+ public Fqn getFqn()
+ {
+ return fqn;
+ }
+
+ /**
+ * @return the index of change in original sequence
+ */
+ public int getHistoricalIndex()
+ {
+ return historicalIndex;
+ }
+
+ /**
+ * @return the changesType
+ */
+ public ChangesType getChangesType()
+ {
+ return changesType;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return fqn + " type=" + changesType + " historyIndex=" + historicalIndex;
+ }
+
+ public int compareTo(ChangesContainer o)
+ {
+ int result = fqn.compareTo(o.getFqn());
+ return result == 0 ? historicalIndex - o.getHistoricalIndex() : result;
+ }
+
+ protected void setCacheLocalMode()
+ {
+ cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(localMode);
+ }
+
+ public final void putExpiration(Fqn efqn)
+ {
+ setCacheLocalMode();
+ cache.put(efqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
+ }
+
+ public abstract void apply();
+ }
+
+ /**
+ * Put object container;
+ */
+ public static class PutObjectContainer extends ChangesContainer
+ {
+ private final Map<? extends Serializable, ? extends Object> data;
+
+ public PutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
+ Cache<Serializable, Object> cache, int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+ {
+ super(fqn, ChangesType.PUT, cache, historicalIndex, local, useExpiration, timeOut);
+
+ this.data = data;
+ }
+
+ @Override
+ public void apply()
+ {
+ setCacheLocalMode();
+ cache.put(fqn, data);
+
+ if (useExpiration)
+ {
+ putExpiration(fqn);
+ }
+ }
+ }
+
+ /**
+ * Put container.
+ */
+ public static class PutKeyValueContainer extends ChangesContainer
+ {
+ private final Serializable key;
+
+ private final Object value;
+
+ public PutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
+ int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+ {
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+ this.key = key;
+ this.value = value;
+ }
+
+ @Override
+ public void apply()
+ {
+ if (useExpiration)
+ {
+ putExpiration(fqn);
+ }
+
+ setCacheLocalMode();
+ cache.put(fqn, key, value);
+ }
+ }
+
+ /**
+ * It tries to get Set by given key. If it is Set then adds new value and puts new set back.
+ * If null found, then new Set created (ordinary cache does).
+ */
+ public static class AddToListContainer extends ChangesContainer
+ {
+ private final Serializable key;
+
+ private final Object value;
+
+ public AddToListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
+ int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+ {
+ super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+ this.key = key;
+ this.value = value;
+ }
+
+ @Override
+ public void apply()
+ {
+ // force writeLock on next read
+ cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
+ // object found by FQN and key;
+ Object existingObject = cache.get(getFqn(), key);
+ Set<Object> newSet = new HashSet<Object>();
+ // if set found of null, perform add
+ if (existingObject instanceof Set || existingObject == null)
+ {
+ // set found
+ if (existingObject instanceof Set)
+ {
+ newSet.addAll((Set<Object>)existingObject);
+ }
+ newSet.add(value);
+
+ if (useExpiration)
+ {
+ putExpiration(fqn);
+ }
+
+ setCacheLocalMode();
+ cache.put(fqn, key, newSet);
+ }
+ else
+ {
+ LOG.error("Unexpected object found by FQN:" + getFqn() + " and key:" + key + ". Expected Set, but found:"
+ + existingObject.getClass().getName());
+ }
+ }
+ }
+
+ /**
+ * It tries to get set by given key. If it is set then removes value and puts new modified set back.
+ */
+ public static class RemoveFromListContainer extends ChangesContainer
+ {
+ private final Serializable key;
+
+ private final Object value;
+
+ public RemoveFromListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
+ int historicalIndex, boolean local, boolean useExpiration, long timeOut)
+ {
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+ this.key = key;
+ this.value = value;
+ }
+
+ @Override
+ public void apply()
+ {
+ // force writeLock on next read
+ cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
+ // object found by FQN and key;
+ setCacheLocalMode();
+ Object existingObject = cache.get(getFqn(), key);
+ // if found value is really set! add to it.
+ if (existingObject instanceof Set)
+ {
+ Set<Object> newSet = new HashSet<Object>((Set<Object>)existingObject);
+ newSet.remove(value);
+
+ if (useExpiration)
+ {
+ putExpiration(fqn);
+ }
+
+ setCacheLocalMode();
+ cache.put(fqn, key, newSet);
+ }
+ }
+ }
+
+ /**
+ * Remove container.
+ */
+ public static class RemoveKeyContainer extends ChangesContainer
+ {
+ private final Serializable key;
+
+ public RemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache, int historicalIndex,
+ boolean local, boolean useExpiration, long timeOut)
+ {
+ super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local, useExpiration, timeOut);
+ this.key = key;
+ }
+
+ @Override
+ public void apply()
+ {
+ setCacheLocalMode();
+ cache.remove(fqn, key);
+ }
+
+ }
+
+ /**
+ * Remove container.
+ */
+ public static class RemoveNodeContainer extends ChangesContainer
+ {
+
+ public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local,
+ boolean useExpiration, long timeOut)
+ {
+ super(fqn, ChangesType.REMOVE, cache, historicalIndex, local, useExpiration, timeOut);
+ }
+
+ @Override
+ public void apply()
+ {
+ setCacheLocalMode();
+ cache.removeNode(fqn);
+ }
+ }
}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChangesContainerExpirationFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChangesContainerExpirationFactory.java 2010-04-08 12:42:09 UTC (rev 2229)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChangesContainerExpirationFactory.java 2010-04-08 12:45:57 UTC (rev 2230)
@@ -1,235 +0,0 @@
-/*
- * Copyright (C) 2003-2010 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
-
-import java.io.Serializable;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * ChahgesContainerExpirationFactory this special factory to ExpirationAlgorithm
- *
- * <br/>Date: 2010
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id$
- */
-public class ChangesContainerExpirationFactory
-extends ChangesContainerFactory
-{
-
- /**
- * The expiration timeout.
- */
- public final long expirationTimeOut;
-
- public ChangesContainerExpirationFactory(long expirationTimeOut)
- {
- this.expirationTimeOut = expirationTimeOut;
- }
-
- /**
- * Put object container;
- */
- public static class PutObjectContainerExpiration extends PutObjectContainer
- {
- private final long timeOut;
-
- public PutObjectContainerExpiration(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
- Cache<Serializable, Object> cache, int historicalIndex, boolean local, long timeOut)
- {
- super(fqn, data, cache, historicalIndex, local);
- this.timeOut = timeOut;
- }
-
- @Override
- public void apply()
- {
- setCacheLocalMode();
- cache.put(fqn, data);
-
- setCacheLocalMode();
- cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
- }
- }
-
- /**
- * Put container.
- */
- public static class PutKeyValueContainerExpiration extends PutKeyValueContainer
- {
- private final long timeOut;
-
- public PutKeyValueContainerExpiration(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local, long timeOut)
- {
- super(fqn, key, value, cache, historicalIndex, local);
- this.timeOut = timeOut;
- }
-
- @Override
- public void apply()
- {
- setCacheLocalMode();
- cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
-
- setCacheLocalMode();
- cache.put(fqn, key, value);
- }
-
- @Override
- public Serializable getKey()
- {
- return key;
- }
-
- @Override
- public Object getValue()
- {
- return value;
- }
-
- }
-
- /**
- * It tries to get Set by given key. If it is Set then adds new value and puts new set back.
- * If null found, then new Set created (ordinary cache does).
- */
- public static class AddToListContainerExpiration extends AddToListContainer
- {
- private final long timeOut;
-
- public AddToListContainerExpiration(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local, long timeOut)
- {
- super(fqn, key, value, cache, historicalIndex, local);
- this.timeOut = timeOut;
- }
-
- @Override
- public void apply()
- {
- // force writeLock on next read
- cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
- // object found by FQN and key;
- Object existingObject = cache.get(getFqn(), key);
- Set<Object> newSet = new HashSet<Object>();
- // if set found of null, perform add
- if (existingObject instanceof Set || existingObject == null)
- {
- // set found
- if (existingObject instanceof Set)
- {
- newSet.addAll((Set<Object>)existingObject);
- }
- newSet.add(value);
-
- setCacheLocalMode();
- cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
-
- setCacheLocalMode();
- cache.put(fqn, key, newSet);
- }
- else
- {
- LOG.error("Unexpected object found by FQN:" + getFqn() + " and key:" + key + ". Expected Set, but found:"
- + existingObject.getClass().getName());
- }
- }
- }
-
- /**
- * It tries to get set by given key. If it is set then removes value and puts new modified set back.
- */
- public static class RemoveFromListContainerExpiration extends RemoveFromListContainer
- {
- private final long timeOut;
-
- public RemoveFromListContainerExpiration(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local, long timeOut)
- {
- super(fqn, key, value, cache, historicalIndex, local);
- this.timeOut = timeOut;
- }
-
- @Override
- public void apply()
- {
- // force writeLock on next read
- cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
- // object found by FQN and key;
- setCacheLocalMode();
- Object existingObject = cache.get(getFqn(), key);
- // if found value is really set! add to it.
- if (existingObject instanceof Set)
- {
- Set<Object> newSet = new HashSet<Object>((Set<Object>)existingObject);
- newSet.remove(value);
-
- setCacheLocalMode();
- cache.put(fqn, ExpirationAlgorithmConfig.EXPIRATION_KEY, new Long(System.currentTimeMillis() + timeOut));
-
- setCacheLocalMode();
- cache.put(fqn, key, newSet);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public ChangesContainer createPutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
- Cache<Serializable, Object> cache, int historicalIndex, boolean local)
- {
- return new PutObjectContainerExpiration(fqn, data, cache, historicalIndex, local, expirationTimeOut);
- }
-
- /**
- * {@inheritDoc}
- */
- public ChangesContainer createPutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
- {
- return new PutKeyValueContainerExpiration(fqn, key, value, cache, historicalIndex, local, expirationTimeOut);
- }
-
- /**
- * {@inheritDoc}
- */
- public ChangesContainer createAddToListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
- {
- return new AddToListContainerExpiration(fqn, key, value, cache, historicalIndex, local, expirationTimeOut);
- }
-
- /**
- * {@inheritDoc}
- */
- public ChangesContainer createRemoveFromListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
- {
- return new RemoveFromListContainerExpiration(fqn, key, value, cache, historicalIndex, local, expirationTimeOut);
- }
-
-}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChangesContainerFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChangesContainerFactory.java 2010-04-08 12:42:09 UTC (rev 2229)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChangesContainerFactory.java 2010-04-08 12:45:57 UTC (rev 2230)
@@ -1,335 +0,0 @@
-/*
- * Copyright (C) 2003-2010 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
-
-import java.io.Serializable;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesType;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * <br/>Date: 2010
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id$
- */
-public class ChangesContainerFactory
-{
- protected static final Log LOG =
- ExoLogger.getLogger("org.exoplatform." +
- "services.jcr.impl.dataflow.persistent.jbosscache.ChangesContatinerFactory");
-
- /**
- * Container for changes
- */
- public static abstract class ChangesContainer implements Comparable<ChangesContainer>
- {
- protected final Fqn fqn;
-
- protected final ChangesType changesType;
-
- protected final Cache<Serializable, Object> cache;
-
- protected final int historicalIndex;
-
- protected final boolean localMode;
-
- public ChangesContainer(Fqn fqn, ChangesType changesType, Cache<Serializable, Object> cache, int historicalIndex,
- boolean localMode)
- {
- super();
- this.fqn = fqn;
- this.changesType = changesType;
- this.cache = cache;
- this.historicalIndex = historicalIndex;
- this.localMode = localMode;
- }
-
- /**
- * @return the fqn
- */
- public Fqn getFqn()
- {
- return fqn;
- }
-
- /**
- * @return the index of change in original sequence
- */
- public int getHistoricalIndex()
- {
- return historicalIndex;
- }
-
- /**
- * @return the changesType
- */
- public ChangesType getChangesType()
- {
- return changesType;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString()
- {
- return fqn + " type=" + changesType + " historyIndex=" + historicalIndex;
- }
-
- public int compareTo(ChangesContainer o)
- {
- int result = fqn.compareTo(o.getFqn());
- return result == 0 ? historicalIndex - o.getHistoricalIndex() : result;
- }
-
- protected void setCacheLocalMode()
- {
- cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(localMode);
- }
-
- public abstract void apply();
- }
-
- /**
- * Put object container;
- */
- public static class PutObjectContainer extends ChangesContainer
- {
- protected final Map<? extends Serializable, ? extends Object> data;
-
- public PutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
- Cache<Serializable, Object> cache, int historicalIndex, boolean local)
- {
- super(fqn, ChangesType.PUT, cache, historicalIndex, local);
-
- this.data = data;
- }
-
- @Override
- public void apply()
- {
- setCacheLocalMode();
- cache.put(fqn, data);
- }
- }
-
- /**
- * Put container.
- */
- public static class PutKeyValueContainer extends ChangesContainer
- {
- protected final Serializable key;
-
- protected final Object value;
-
- public PutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
- {
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local);
- this.key = key;
- this.value = value;
- }
-
- @Override
- public void apply()
- {
- setCacheLocalMode();
- cache.put(fqn, key, value);
- }
-
- public Serializable getKey()
- {
- return key;
- }
-
- public Object getValue()
- {
- return value;
- }
-
- }
-
- /**
- * It tries to get Set by given key. If it is Set then adds new value and puts new set back.
- * If null found, then new Set created (ordinary cache does).
- */
- public static class AddToListContainer extends ChangesContainer
- {
- protected final Serializable key;
-
- protected final Object value;
-
- public AddToListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
- {
- super(fqn, ChangesType.PUT_KEY, cache, historicalIndex, local);
- this.key = key;
- this.value = value;
- }
-
- @Override
- public void apply()
- {
- // force writeLock on next read
- cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
- // object found by FQN and key;
- Object existingObject = cache.get(getFqn(), key);
- Set<Object> newSet = new HashSet<Object>();
- // if set found of null, perform add
- if (existingObject instanceof Set || existingObject == null)
- {
- // set found
- if (existingObject instanceof Set)
- {
- newSet.addAll((Set<Object>)existingObject);
- }
- newSet.add(value);
- setCacheLocalMode();
- cache.put(fqn, key, newSet);
- }
- else
- {
- LOG.error("Unexpected object found by FQN:" + getFqn() + " and key:" + key + ". Expected Set, but found:"
- + existingObject.getClass().getName());
- }
- }
- }
-
- /**
- * It tries to get set by given key. If it is set then removes value and puts new modified set back.
- */
- public static class RemoveFromListContainer extends ChangesContainer
- {
- protected final Serializable key;
-
- protected final Object value;
-
- public RemoveFromListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
- {
- super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local);
- this.key = key;
- this.value = value;
- }
-
- @Override
- public void apply()
- {
- // force writeLock on next read
- cache.getInvocationContext().getOptionOverrides().setForceWriteLock(true);
- // object found by FQN and key;
- setCacheLocalMode();
- Object existingObject = cache.get(getFqn(), key);
- // if found value is really set! add to it.
- if (existingObject instanceof Set)
- {
- Set<Object> newSet = new HashSet<Object>((Set<Object>)existingObject);
- newSet.remove(value);
- setCacheLocalMode();
- cache.put(fqn, key, newSet);
- }
- }
- }
-
- /**
- * Remove container.
- */
- public static class RemoveKeyContainer extends ChangesContainer
- {
- private final Serializable key;
-
- public RemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache, int historicalIndex,
- boolean local)
- {
- super(fqn, ChangesType.REMOVE_KEY, cache, historicalIndex, local);
- this.key = key;
- }
-
- @Override
- public void apply()
- {
- setCacheLocalMode();
- cache.remove(fqn, key);
- }
-
- }
-
- /**
- * Remove container.
- */
- public static class RemoveNodeContainer extends ChangesContainer
- {
-
- public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local)
- {
- super(fqn, ChangesType.REMOVE, cache, historicalIndex, local);
- }
-
- @Override
- public void apply()
- {
- setCacheLocalMode();
- cache.removeNode(fqn);
- }
- }
-
- public ChangesContainer createPutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
- Cache<Serializable, Object> cache, int historicalIndex, boolean local)
- {
- return new PutObjectContainer(fqn, data, cache, historicalIndex, local);
- }
-
- public ChangesContainer createPutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
- {
- return new PutKeyValueContainer(fqn, key, value, cache, historicalIndex, local);
- }
-
- public ChangesContainer createAddToListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
- {
- return new AddToListContainer(fqn, key, value, cache, historicalIndex, local);
- }
-
- public ChangesContainer createRemoveFromListContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
- int historicalIndex, boolean local)
- {
- return new RemoveFromListContainer(fqn, key, value, cache, historicalIndex, local);
- }
-
- public ChangesContainer createRemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache, int historicalIndex,
- boolean local)
- {
- return new RemoveKeyContainer(fqn, key, cache, historicalIndex, local);
- }
-
- public ChangesContainer createRemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex, boolean local)
- {
- return new RemoveNodeContainer(fqn, cache, historicalIndex, local);
- }
-
-}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java 2010-04-08 12:42:09 UTC (rev 2229)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/CompressedChangesBuffer.java 2010-04-08 12:45:57 UTC (rev 2230)
@@ -24,8 +24,8 @@
import java.util.List;
import java.util.Map;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesType;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChangesContainerFactory.ChangesContainer;
import org.jboss.cache.Fqn;
/**
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-04-08 12:42:09 UTC (rev 2229)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-04-08 12:45:57 UTC (rev 2230)
@@ -306,9 +306,8 @@
// if expiration is used, set appropriate factory with with timeout set via configuration (or default one 15minutes)
this.cache =
- new BufferedJBossCache(factory.createCache(wsConfig.getCache()), useExpiration
- ? new ChangesContainerExpirationFactory(wsConfig.getCache().getParameterInteger(JBOSSCACHE_EXPIRATION,
- JBOSSCACHE_EXPIRATION_DEFAULT)) : new ChangesContainerFactory());
+ new BufferedJBossCache(factory.createCache(wsConfig.getCache()), useExpiration,
+ wsConfig.getCache().getParameterInteger(JBOSSCACHE_EXPIRATION, JBOSSCACHE_EXPIRATION_DEFAULT));
this.itemsRoot = Fqn.fromElements(ITEMS);
this.childNodes = Fqn.fromElements(CHILD_NODES);
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java 2010-04-08 12:42:09 UTC (rev 2229)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestCompressedChangesBuffer.java 2010-04-08 12:45:57 UTC (rev 2230)
@@ -22,9 +22,9 @@
import junit.framework.TestCase;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChangesContainerFactory.ChangesContainer;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChangesContainerFactory.PutObjectContainer;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChangesContainerFactory.RemoveNodeContainer;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.ChangesContainer;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.PutObjectContainer;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.BufferedJBossCache.RemoveNodeContainer;
import org.jboss.cache.Fqn;
/**
@@ -40,13 +40,13 @@
CompressedChangesBuffer buffer = new CompressedChangesBuffer();
ChangesContainer put1 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
ChangesContainer put2 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
ChangesContainer rm1 =
new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"), null, buffer
- .getHistoryIndex(), false);
+ .getHistoryIndex(), false, false, 0);
buffer.add(put1);
buffer.add(put2);
assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
@@ -67,17 +67,17 @@
CompressedChangesBuffer buffer = new CompressedChangesBuffer();
ChangesContainer put1 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
ChangesContainer put2 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
ChangesContainer rm1 =
new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b/c"), null,
- buffer.getHistoryIndex(), false);
+ buffer.getHistoryIndex(), false, false, 0);
ChangesContainer rm2 =
new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES + "/b"), null, buffer
- .getHistoryIndex(), false);
+ .getHistoryIndex(), false, false, 0);
buffer.add(put1);
buffer.add(put2);
assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
@@ -97,11 +97,11 @@
CompressedChangesBuffer buffer = new CompressedChangesBuffer();
ChangesContainer put1 =
new PutObjectContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST + "/b"),
- new HashMap<String, String>(), null, buffer.getHistoryIndex(), false);
+ new HashMap<String, String>(), null, buffer.getHistoryIndex(), false, false, 0);
ChangesContainer rm1 =
new RemoveNodeContainer(Fqn.fromString("/" + JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST + "/b"), null,
- buffer.getHistoryIndex(), false);
+ buffer.getHistoryIndex(), false, false, 0);
buffer.add(put1);
assertTrue("List MUST contain put container", buffer.getSortedList().contains(put1));
buffer.add(rm1);
14 years, 1 month
exo-jcr SVN: r2229 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-04-08 08:42:09 -0400 (Thu, 08 Apr 2010)
New Revision: 2229
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
Log:
EXOJCR-545: Configuration analyzer re-written.
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-04-08 11:39:53 UTC (rev 2228)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-04-08 12:42:09 UTC (rev 2229)
@@ -42,7 +42,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.config.EvictionRegionConfig;
-import org.jboss.cache.eviction.ExpirationAlgorithm;
+import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
import java.io.Serializable;
import java.util.ArrayList;
@@ -287,22 +287,16 @@
evictionConfigurations.add(parentCache.getConfiguration().getEvictionConfig().getDefaultEvictionRegionConfig());
boolean useExpiration = false;
- Iterator<EvictionRegionConfig> iterator = evictionConfigurations.iterator();
-
// looking over all eviction configurations till the end or till some expiration algorithm subclass not found.
- while (iterator.hasNext() && !useExpiration)
+ for (EvictionRegionConfig evictionRegionConfig : evictionConfigurations)
{
- try
+ if (evictionRegionConfig.getEvictionAlgorithmConfig() instanceof ExpirationAlgorithmConfig)
{
- String evictionClassName = iterator.next().getEvictionAlgorithmConfig().getEvictionAlgorithmClassName();
- Class<?> evictionClass = Class.forName(evictionClassName);
- // returns true if ExpirationAlgorithm is superClass of evictionClass
- useExpiration = useExpiration || ExpirationAlgorithm.class.isAssignableFrom(evictionClass);
+ // force set expiration key to default value in all Expiration configurations (if any)
+ ((ExpirationAlgorithmConfig)evictionRegionConfig.getEvictionAlgorithmConfig())
+ .setExpirationKeyName(ExpirationAlgorithmConfig.EXPIRATION_KEY);
+ useExpiration = true;
}
- catch (ClassNotFoundException e)
- {
- throw new RepositoryConfigurationException("Unable to check JBossCache eviction class.", e);
- }
}
if (useExpiration)
14 years, 1 month
exo-jcr SVN: r2228 - jcr/branches/1.14.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-04-08 07:39:53 -0400 (Thu, 08 Apr 2010)
New Revision: 2228
Modified:
jcr/branches/1.14.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
Log:
EXOJCR-609: small fix
Modified: jcr/branches/1.14.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.14.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-04-08 11:10:25 UTC (rev 2227)
+++ jcr/branches/1.14.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-04-08 11:39:53 UTC (rev 2228)
@@ -808,15 +808,8 @@
*/
protected ItemData putNode(NodeData node, ModifyChildOption modifyListsOfChild)
{
-
- // remove possible NullNodeData from cache
- boolean local = cache.isLocal();
- cache.setLocal(false);
-
removeNullNode(node);
- cache.setLocal(local);
-
// if not a root node
if (node.getParentIdentifier() != null)
{
@@ -856,6 +849,10 @@
*/
protected void removeNullNode(ItemData item)
{
+ // remove possible NullNodeData from cache
+ boolean local = cache.isLocal();
+ cache.setLocal(true);
+
Fqn<String> fqn = makeNullItemFqn(item.getIdentifier());
if ((NullNodeData)cache.get(fqn, ITEM_DATA) != null)
{
@@ -869,6 +866,8 @@
{
cache.removeNode(fqn);
}
+
+ cache.setLocal(local);
}
protected ItemData putNodeInBufferedCache(NodeData node, ModifyChildOption modifyListsOfChild)
@@ -900,15 +899,8 @@
*/
protected PropertyData putProperty(PropertyData prop, ModifyChildOption modifyListsOfChild)
{
-
- // remove possible NullNodeData from cache
- boolean local = cache.isLocal();
- cache.setLocal(false);
-
removeNullNode(prop);
- cache.setLocal(local);
-
// add in CHILD_PROPS
cache.put(makeChildFqn(childProps, prop.getParentIdentifier(), prop.getQPath().getEntries()[prop.getQPath()
.getEntries().length - 1]), ITEM_ID, prop.getIdentifier());
14 years, 1 month