Author: areshetnyak
Date: 2010-01-06 04:00:54 -0500 (Wed, 06 Jan 2010)
New Revision: 1306
Added:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChildListEvictionActionPolicy.java
Removed:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ExoEvictionActionPolicy.java
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestExoEvictionActionPolicy.java
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-exo-config.xml
Log:
EXOJCR-333 : Rename class ExoEvictionActionPolicy to ChildListEvictionActionPolicy..
Added:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChildListEvictionActionPolicy.java
===================================================================
---
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChildListEvictionActionPolicy.java
(rev 0)
+++
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChildListEvictionActionPolicy.java 2010-01-06
09:00:54 UTC (rev 1306)
@@ -0,0 +1,82 @@
+/*
+ * 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.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.jboss.cache.Cache;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.eviction.EvictionActionPolicy;
+
+/**
+ * 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 ChildListEvictionActionPolicy
+ implements EvictionActionPolicy
+{
+ private static final Log LOG =
ExoLogger.getLogger("jcr.ExoEvictionActionPolicy");
+
+ private Cache<?, ?> cache;
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean evict(Fqn fqn)
+ {
+
+ if (fqn.size() == 3 &&
(JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST.equals(fqn.get(0)) ||
JBossCacheWorkspaceStorageCache.CHILD_PROPS_LIST.equals(fqn.get(0))))
+ {
+ return eviction(fqn.getParent(), true);
+ }
+ else
+ {
+ return eviction(fqn, false);
+ }
+ }
+
+ private boolean eviction(Fqn fqn, boolean recurcive)
+ {
+ try
+ {
+ if (LOG.isDebugEnabled())
+ LOG.debug("Evicting Fqn " + fqn);
+
+ cache.evict(fqn, recurcive);
+ return true;
+ }
+ catch (Exception e)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.debug("Unable to evict " + fqn, e);
+ return false;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setCache(Cache<?, ?> cache)
+ {
+ this.cache = cache;
+ }
+
+}
Property changes on:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ChildListEvictionActionPolicy.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Deleted:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ExoEvictionActionPolicy.java
===================================================================
---
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ExoEvictionActionPolicy.java 2010-01-05
22:16:55 UTC (rev 1305)
+++
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ExoEvictionActionPolicy.java 2010-01-06
09:00:54 UTC (rev 1306)
@@ -1,82 +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.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.eviction.EvictionActionPolicy;
-
-/**
- * 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 ExoEvictionActionPolicy
- implements EvictionActionPolicy
-{
- private static final Log LOG =
ExoLogger.getLogger("jcr.ExoEvictionActionPolicy");
-
- private Cache<?, ?> cache;
-
- /**
- * {@inheritDoc}
- */
- public boolean evict(Fqn fqn)
- {
-
- if (fqn.size() == 3 &&
(JBossCacheWorkspaceStorageCache.CHILD_NODES_LIST.equals(fqn.get(0)) ||
JBossCacheWorkspaceStorageCache.CHILD_PROPS_LIST.equals(fqn.get(0))))
- {
- return eviction(fqn.getParent(), true);
- }
- else
- {
- return eviction(fqn, false);
- }
- }
-
- private boolean eviction(Fqn fqn, boolean recurcive)
- {
- try
- {
- if (LOG.isDebugEnabled())
- LOG.debug("Evicting Fqn " + fqn);
-
- cache.evict(fqn, recurcive);
- return true;
- }
- catch (Exception e)
- {
- if (LOG.isDebugEnabled())
- LOG.debug("Unable to evict " + fqn, e);
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void setCache(Cache<?, ?> cache)
- {
- this.cache = cache;
- }
-
-}
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestExoEvictionActionPolicy.java
===================================================================
---
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestExoEvictionActionPolicy.java 2010-01-05
22:16:55 UTC (rev 1305)
+++
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestExoEvictionActionPolicy.java 2010-01-06
09:00:54 UTC (rev 1306)
@@ -81,6 +81,14 @@
cacheRoot.addChild(this.childPropsList).setResident(true);
}
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ cache.stop();
+ cache.destroy();
+ }
+
protected void initJBCConfig()
{
jbcConfig =
"src/test/resources/conf/standalone/test-jbosscache-exo-config.xml";
@@ -156,7 +164,7 @@
@NodeEvicted
public void createdNodeEvent(NodeEvent ne)
{
- System.out.println("Node evicred: " + ne.getFqn());
+ System.out.println("Node evicted: " + ne.getFqn());
}
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml
===================================================================
---
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml 2010-01-05
22:16:55 UTC (rev 1305)
+++
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-config.xml 2010-01-06
09:00:54 UTC (rev 1306)
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:jboss:jbosscache-core:config:3.1">
+ <locking useLockStriping="false" concurrencyLevel="50000"
lockParentForChildInsertRemove="false"
lockAcquisitionTimeout="3600000"/>
+
<!-- Configure the TransactionManager -->
<transaction
transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup"
/>
@@ -13,7 +15,7 @@
<property name="maxNodes" value="5000" />
<property name="timeToLiveSeconds" value="120" />
</default>
- <region name="/"
algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ExoEvictionActionPolicy"
eventQueueSize="1000000">
+ <region name="/"
algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChildListEvictionActionPolicy"
eventQueueSize="1000000">
<property name="maxNodes" value="5000" />
<property name="timeToLiveSeconds" value="120" />
</region>
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-exo-config.xml
===================================================================
---
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-exo-config.xml 2010-01-05
22:16:55 UTC (rev 1305)
+++
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/test/resources/conf/standalone/test-jbosscache-exo-config.xml 2010-01-06
09:00:54 UTC (rev 1306)
@@ -15,7 +15,7 @@
<property name="maxNodes" value="50" />
<property name="timeToLiveSeconds" value="20" />
</default>
- <region name="/"
algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ExoEvictionActionPolicy"
eventQueueSize="1000000">
+ <region name="/"
algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ChildListEvictionActionPolicy"
eventQueueSize="1000000">
<property name="maxNodes" value="50" />
<property name="timeToLiveSeconds" value="20" />
</region>