[exo-jcr-commits] exo-jcr SVN: r1327 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Jan 8 11:00:01 EST 2010
Author: nzamosenchuk
Date: 2010-01-08 11:00:00 -0500 (Fri, 08 Jan 2010)
New Revision: 1327
Modified:
jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
Log:
EXOJCR-371: added ordering by hystorica index, if FQNs are equals.
Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2010-01-08 15:57:22 UTC (rev 1326)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/BufferedJBossCache.java 2010-01-08 16:00:00 UTC (rev 1327)
@@ -25,7 +25,7 @@
@SuppressWarnings("unchecked")
public class BufferedJBossCache implements Cache<Serializable, Object>
{
-// private final Log log = ExoLogger.getLogger(BufferedJbossCache.class);
+ // private final Log log = ExoLogger.getLogger(BufferedJbossCache.class);
/**
* Parent cache.
@@ -352,7 +352,7 @@
{
throw new IllegalStateException("changesContainer should not be empty");
}
- changesContainer.add(new PutObjectContainer(fqn, data, parentCache));
+ changesContainer.add(new PutObjectContainer(fqn, data, parentCache, changesContainer.size()));
}
/* (non-Javadoc)
@@ -365,7 +365,7 @@
{
throw new IllegalStateException("changesContainer should not be empty");
}
- changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache));
+ changesContainer.add(new PutKeyValueContainer(fqn, key, value, parentCache, changesContainer.size()));
return parentCache.get(fqn, key);
}
@@ -405,7 +405,7 @@
{
throw new IllegalStateException("changesContainer should not be empty");
}
- changesContainer.add(new RemoveKeyContainer(fqn, key, parentCache));
+ changesContainer.add(new RemoveKeyContainer(fqn, key, parentCache, changesContainer.size()));
return parentCache.get(fqn, key);
}
@@ -451,7 +451,7 @@
{
throw new IllegalStateException("changesContainer should not be empty");
}
- changesContainer.add(new RemoveNodeContainer(fqn, parentCache));
+ changesContainer.add(new RemoveNodeContainer(fqn, parentCache, changesContainer.size()));
return true;
}
@@ -508,8 +508,7 @@
return ((CacheSPI<Serializable, Object>)parentCache).getTransactionManager();
}
- private static enum ChangesType
- {
+ private static enum ChangesType {
REMOVED, ADDED;
}
@@ -526,12 +525,15 @@
protected final Cache<Serializable, Object> cache;
- public ChangesContainer(Fqn fqn, ChangesType changesType, Cache<Serializable, Object> cache)
+ protected final int historicalIndex;
+
+ public ChangesContainer(Fqn fqn, ChangesType changesType, Cache<Serializable, Object> cache, int historicalIndex)
{
super();
this.fqn = fqn;
this.changesType = changesType;
this.cache = cache;
+ this.historicalIndex = historicalIndex;
}
/**
@@ -543,6 +545,14 @@
}
/**
+ * @return the index of change in original sequence
+ */
+ public int getHistoricalIndex()
+ {
+ return historicalIndex;
+ }
+
+ /**
* @return the changesType
*/
public ChangesType getChangesType()
@@ -556,13 +566,13 @@
@Override
public String toString()
{
- return fqn + " type=" + changesType;
+ return fqn + " type=" + changesType + " historyIndex=" + historicalIndex;
}
public int compareTo(ChangesContainer o)
{
int result = fqn.compareTo(o.getFqn());
- return result == 0 ? -1 : result;
+ return result == 0 ? historicalIndex - o.getHistoricalIndex() : result;
}
public abstract void apply();
@@ -578,9 +588,9 @@
private final Map<? extends Serializable, ? extends Object> data;
public PutObjectContainer(Fqn fqn, Map<? extends Serializable, ? extends Object> data,
- Cache<Serializable, Object> cache)
+ Cache<Serializable, Object> cache, int historicalIndex)
{
- super(fqn, ChangesType.ADDED, cache);
+ super(fqn, ChangesType.ADDED, cache, historicalIndex);
this.data = data;
}
@@ -603,9 +613,10 @@
private final Object value;
- public PutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache)
+ public PutKeyValueContainer(Fqn fqn, Serializable key, Object value, Cache<Serializable, Object> cache,
+ int historicalIndex)
{
- super(fqn, ChangesType.ADDED, cache);
+ super(fqn, ChangesType.ADDED, cache, historicalIndex);
this.key = key;
this.value = value;
}
@@ -626,9 +637,9 @@
{
private final Serializable key;
- public RemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache)
+ public RemoveKeyContainer(Fqn fqn, Serializable key, Cache<Serializable, Object> cache, int historicalIndex)
{
- super(fqn, ChangesType.REMOVED, cache);
+ super(fqn, ChangesType.REMOVED, cache, historicalIndex);
this.key = key;
}
@@ -649,9 +660,9 @@
private static class RemoveNodeContainer extends ChangesContainer
{
- public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache)
+ public RemoveNodeContainer(Fqn fqn, Cache<Serializable, Object> cache, int historicalIndex)
{
- super(fqn, ChangesType.REMOVED, cache);
+ super(fqn, ChangesType.REMOVED, cache, historicalIndex);
}
@Override
More information about the exo-jcr-commits
mailing list