JBoss Cache SVN: r6090 - core/trunk/src/main/java/org/jboss/cache/commands/write.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-27 08:17:04 -0400 (Fri, 27 Jun 2008)
New Revision: 6090
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
Log:
Eviction needs to look at tombstones as well.
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-06-27 12:08:41 UTC (rev 6089)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-06-27 12:17:04 UTC (rev 6090)
@@ -50,7 +50,9 @@
*/
public Object perform(InvocationContext ctx)
{
- NodeSPI node = ctx.lookUpNode(fqn);
+ //NodeSPI node = ctx.lookUpNode(fqn);
+ // TODO: MVCC - eviction actually needs to look at invalid nodes (tombstones) as well.
+ NodeSPI node = dataContainer.peek(fqn, false, true);
if (node == null)
{
return false;
16 years, 6 months
JBoss Cache SVN: r6089 - core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-27 08:08:41 -0400 (Fri, 27 Jun 2008)
New Revision: 6089
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
Log:
Fixed peek
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-06-27 11:44:33 UTC (rev 6088)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-06-27 12:08:41 UTC (rev 6089)
@@ -50,7 +50,7 @@
*/
public Object perform(InvocationContext ctx)
{
- NodeSPI node = dataContainer.peek(fqn, false, false);
+ NodeSPI node = dataContainer.peek(fqn, false, true);
if (node == null)
{
return false;
16 years, 6 months
JBoss Cache SVN: r6088 - core/trunk/src/test/java/org/jboss/cache/api.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-27 07:44:33 -0400 (Fri, 27 Jun 2008)
New Revision: 6088
Modified:
core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
Log:
proper ctx setup
Modified: core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java 2008-06-27 11:39:56 UTC (rev 6087)
+++ core/trunk/src/test/java/org/jboss/cache/api/SyncReplTxTest.java 2008-06-27 11:44:33 UTC (rev 6088)
@@ -13,7 +13,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.config.Configuration.CacheMode;
-import org.jboss.cache.config.Option;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.invocation.InvocationContext;
import org.jboss.cache.util.TestingUtil;
@@ -153,7 +152,6 @@
control = ctx.copy();
control.reset();
- control.setOptionOverrides(new Option());
assertEquals("Should be equal", control, ctx);
}
16 years, 6 months
JBoss Cache SVN: r6087 - searchable/trunk/src/main/java/org/jboss/cache/search.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-27 07:39:56 -0400 (Fri, 27 Jun 2008)
New Revision: 6087
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
Log:
Genericized
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java 2008-06-27 11:29:56 UTC (rev 6086)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCache.java 2008-06-27 11:39:56 UTC (rev 6087)
@@ -4,15 +4,14 @@
import org.jboss.cache.Cache;
/**
-@author Navin Surtani - navin(a)surtani.org
-
- This will be the most used interface in JBossCache searchable. It extends Cache and therefore will have
- the standard get(), put() and remove() methods. The additional method is the createQuery method which people
- will use to build their Hibernate Search queries from a luceneQuery - Hibernate Search users will be very familiar
- with this.
-
+ * @author Navin Surtani - navin(a)surtani.org
+ * <p/>
+ * This will be the most used interface in JBossCache searchable. It extends Cache and therefore will have
+ * the standard get(), put() and remove() methods. The additional method is the createQuery method which people
+ * will use to build their Hibernate Search queries from a luceneQuery - Hibernate Search users will be very familiar
+ * with this.
*/
-public interface SearchableCache extends Cache
+public interface SearchableCache<K, V> extends Cache<K, V>
{
/**
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2008-06-27 11:29:56 UTC (rev 6086)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2008-06-27 11:39:56 UTC (rev 6087)
@@ -8,7 +8,7 @@
import java.util.Properties;
/**
-@author Navin Surtani - navin(a)surtani.org
+ * @author Navin Surtani - navin(a)surtani.org
*/
public class SearchableCacheFactory
{
@@ -21,7 +21,7 @@
* @param classes
* @return
*/
- public SearchableCache createSearchableCache (Cache c, Class... classes)
+ public SearchableCache createSearchableCache(Cache<?, ?> c, Class... classes)
{
return createSearchableCache(c, null, classes);
}
@@ -34,7 +34,7 @@
* @param classes
* @return
*/
- public SearchableCache createSearchableCache (Cache c, Properties properties, Class... classes)
+ public SearchableCache createSearchableCache(Cache<?, ?> c, Properties properties, Class... classes)
{
// assume cache is already created and running.
// otherwise, start the cache!!
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-27 11:29:56 UTC (rev 6086)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-27 11:39:56 UTC (rev 6087)
@@ -2,7 +2,6 @@
import org.apache.lucene.search.Query;
import org.hibernate.search.impl.SearchFactoryImpl;
-import org.hibernate.search.FullTextQuery;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheStatus;
@@ -23,14 +22,14 @@
* <p/>
* Implementation class for the SearchableCache interface.
*/
-public class SearchableCacheImpl implements SearchableCache
+public class SearchableCacheImpl<K, V> implements SearchableCache<K, V>
{
// this is the ACTUAL cache. that does all the work.
- private Cache cache;
+ private Cache<K, V> cache;
private SearchFactoryImpl searchFactory;
//TODO: javadoc!!
- public SearchableCacheImpl(Cache cache, SearchFactoryImpl searchFactory)
+ public SearchableCacheImpl(Cache<K, V> cache, SearchFactoryImpl searchFactory)
{
this.cache = cache;
this.searchFactory = searchFactory;
@@ -73,17 +72,17 @@
return cache.getCacheListeners();
}
- public Object put(String fqn, Object key, Object value)
+ public V put(String fqn, K key, V value)
{
return cache.put(fqn, key, value);
}
- public void put(String fqn, Map data)
+ public void put(String fqn, Map<K, V> data)
{
cache.put(fqn, data);
}
- public Object remove(String fqn, Object key)
+ public V remove(String fqn, K key)
{
return cache.remove(fqn, key);
}
@@ -98,7 +97,7 @@
return cache.getNode(fqn);
}
- public Object get(String fqn, Object key)
+ public V get(String fqn, K key)
{
return cache.get(fqn, key);
}
@@ -158,7 +157,7 @@
return cache.getVersion();
}
- public Set getKeys(String fqn)
+ public Set<K> getKeys(String fqn)
{
return cache.getKeys(fqn);
}
@@ -168,77 +167,77 @@
cache.clearData(fqn);
}
- public void clearData(Fqn fqn)
+ public void clearData(Fqn<?> fqn)
{
cache.clearData(fqn);
}
- public Set getKeys(Fqn fqn)
+ public Set getKeys(Fqn<?> fqn)
{
return cache.getKeys(fqn);
}
- public Map getData(Fqn fqn)
+ public Map getData(Fqn<?> fqn)
{
return cache.getData(fqn);
}
- public void move(Fqn nodeToMove, Fqn newParent) throws NodeNotExistsException
+ public void move(Fqn<?> nodeToMove, Fqn<?> newParent) throws NodeNotExistsException
{
cache.move(nodeToMove, newParent);
}
- public boolean removeRegion(Fqn fqn)
+ public boolean removeRegion(Fqn<?> fqn)
{
return cache.removeRegion(fqn);
}
- public Region getRegion(Fqn fqn, boolean createIfAbsent)
+ public Region getRegion(Fqn<?> fqn, boolean createIfAbsent)
{
return cache.getRegion(fqn, createIfAbsent);
}
- public void evict(Fqn fqn)
+ public void evict(Fqn<?> fqn)
{
cache.evict(fqn);
}
- public void evict(Fqn fqn, boolean recursive)
+ public void evict(Fqn<?> fqn, boolean recursive)
{
cache.evict(fqn, recursive);
}
- public Object get(Fqn fqn, Object key)
+ public V get(Fqn<?> fqn, K key)
{
return cache.get(fqn, key);
}
- public Node getNode(Fqn fqn)
+ public Node getNode(Fqn<?> fqn)
{
return cache.getNode(fqn);
}
- public boolean removeNode(Fqn fqn)
+ public boolean removeNode(Fqn<?> fqn)
{
return cache.removeNode(fqn);
}
- public Object remove(Fqn fqn, Object key)
+ public V remove(Fqn<?> fqn, K key)
{
return cache.remove(fqn, key);
}
- public void put(Fqn fqn, Map data)
+ public void put(Fqn<?> fqn, Map<K, V> data)
{
cache.put(fqn, data);
}
- public void putForExternalRead(Fqn fqn, Object key, Object value)
+ public void putForExternalRead(Fqn<?> fqn, K key, V value)
{
cache.putForExternalRead(fqn, key, value);
}
- public Object put(Fqn fqn, Object key, Object value)
+ public V put(Fqn<?> fqn, K key, V value)
{
return cache.put(fqn, key, value);
}
16 years, 6 months
JBoss Cache SVN: r6086 - in core/trunk/src/main/java/org/jboss/cache/commands: write and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-27 07:29:56 -0400 (Fri, 27 Jun 2008)
New Revision: 6086
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/VersionedInvalidateCommand.java
Log:
Null checks
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java 2008-06-27 11:10:02 UTC (rev 6085)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java 2008-06-27 11:29:56 UTC (rev 6086)
@@ -41,7 +41,7 @@
*/
public Object perform(InvocationContext ctx)
{
- NodeSPI n = ctx.lookUpNode(fqn);
+ NodeSPI n = fqn == null ? null : ctx.lookUpNode(fqn);
if (n == null) return null;
Map childrenMap = n.getChildrenMapDirect();
if (childrenMap == null || childrenMap.isEmpty()) return Collections.emptySet();
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/VersionedInvalidateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/VersionedInvalidateCommand.java 2008-06-27 11:10:02 UTC (rev 6085)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/VersionedInvalidateCommand.java 2008-06-27 11:29:56 UTC (rev 6086)
@@ -83,7 +83,8 @@
{
throw new NullPointerException("Node " + node.getFqn() + " has a null data version, and is of type " + node.getClass().getSimpleName() + ". This command expects versioned nodes.");
}
- else if (node.getVersion().newerThan(dataVersion))
+ else
+ if (dataVersion != null && node.getVersion().newerThan(dataVersion)) // dataVersion *could* be null if the invalidate was triggered by removing a node that did not exist in the first place.
{
String errMsg = new StringBuilder("Node found, but version is not equal to or less than the expected [").append(dataVersion).append("]. Is [").append(node.getVersion()).append("] instead!").toString();
log.warn(errMsg);
16 years, 6 months
JBoss Cache SVN: r6085 - searchable/trunk/src/main/java/org/jboss/cache/search.
by jbosscache-commits@lists.jboss.org
Author: navssurtani
Date: 2008-06-27 07:10:02 -0400 (Fri, 27 Jun 2008)
New Revision: 6085
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
Log:
SearchableCacheImpl barfing.
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-27 11:05:39 UTC (rev 6084)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-06-27 11:10:02 UTC (rev 6085)
@@ -37,12 +37,12 @@
}
- public FullTextQuery createQuery(Query luceneQuery)
+ public CacheQuery createQuery(Query luceneQuery)
{
return new CacheQueryImpl(luceneQuery, searchFactory, cache);
}
- public FullTextQuery createQuery(Query luceneQuery, Class... classes)
+ public CacheQuery createQuery(Query luceneQuery, Class... classes)
{
return new CacheQueryImpl(luceneQuery, searchFactory, cache, classes);
16 years, 6 months
JBoss Cache SVN: r6084 - core/trunk/src/test/java/org/jboss/cache/util/concurrent/locks.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-27 07:05:39 -0400 (Fri, 27 Jun 2008)
New Revision: 6084
Modified:
core/trunk/src/test/java/org/jboss/cache/util/concurrent/locks/OwnableReentrantLockTest.java
Log:
Fixed broken setup
Modified: core/trunk/src/test/java/org/jboss/cache/util/concurrent/locks/OwnableReentrantLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/concurrent/locks/OwnableReentrantLockTest.java 2008-06-27 07:49:41 UTC (rev 6083)
+++ core/trunk/src/test/java/org/jboss/cache/util/concurrent/locks/OwnableReentrantLockTest.java 2008-06-27 11:05:39 UTC (rev 6084)
@@ -1,5 +1,6 @@
package org.jboss.cache.util.concurrent.locks;
+import org.jboss.cache.factories.context.MVCCContextFactory;
import org.jboss.cache.invocation.InvocationContextContainer;
import org.jboss.cache.transaction.GlobalTransaction;
import org.testng.annotations.Test;
@@ -15,9 +16,16 @@
@Test(groups = "unit")
public class OwnableReentrantLockTest
{
+ private InvocationContextContainer getInvocationContextContainer()
+ {
+ InvocationContextContainer icc = new InvocationContextContainer();
+ icc.injectContextFactory(new MVCCContextFactory());
+ return icc;
+ }
+
public void testReentrancyThread()
{
- InvocationContextContainer icc = new InvocationContextContainer();
+ InvocationContextContainer icc = getInvocationContextContainer();
OwnableReentrantLock lock = new OwnableReentrantLock(icc);
lock.lock(); // locked by current thread
@@ -39,7 +47,7 @@
public void testReentrancyGtx()
{
- InvocationContextContainer icc = new InvocationContextContainer();
+ InvocationContextContainer icc = getInvocationContextContainer();
OwnableReentrantLock lock = new OwnableReentrantLock(icc);
// create and set a gtx
@@ -66,7 +74,7 @@
public void testReentrancyNotSameGtx()
{
- InvocationContextContainer icc = new InvocationContextContainer();
+ InvocationContextContainer icc = getInvocationContextContainer();
OwnableReentrantLock lock = new OwnableReentrantLock(icc);
// create and set a gtx
@@ -100,7 +108,7 @@
public void testThreadLockedByThread() throws InterruptedException
{
- InvocationContextContainer icc = new InvocationContextContainer();
+ InvocationContextContainer icc = getInvocationContextContainer();
final OwnableReentrantLock lock = new OwnableReentrantLock(icc);
final AtomicBoolean acquired = new AtomicBoolean(false);
final AtomicBoolean threwExceptionOnRelease = new AtomicBoolean(false);
@@ -147,7 +155,7 @@
public void testThreadLockedByGtx() throws InterruptedException
{
- InvocationContextContainer icc = new InvocationContextContainer();
+ InvocationContextContainer icc = getInvocationContextContainer();
final OwnableReentrantLock lock = new OwnableReentrantLock(icc);
GlobalTransaction gtx = new GlobalTransaction();
gtx.setId(10);
@@ -196,7 +204,7 @@
public void testGtxLockedByThread() throws InterruptedException
{
- final InvocationContextContainer icc = new InvocationContextContainer();
+ final InvocationContextContainer icc = getInvocationContextContainer();
final OwnableReentrantLock lock = new OwnableReentrantLock(icc);
final AtomicBoolean acquired = new AtomicBoolean(false);
final AtomicBoolean threwExceptionOnRelease = new AtomicBoolean(false);
@@ -245,7 +253,7 @@
public void testGtxLockedByGtxFail() throws InterruptedException
{
- final InvocationContextContainer icc = new InvocationContextContainer();
+ final InvocationContextContainer icc = getInvocationContextContainer();
final OwnableReentrantLock lock = new OwnableReentrantLock(icc);
final AtomicBoolean acquired = new AtomicBoolean(false);
final AtomicBoolean threwExceptionOnRelease = new AtomicBoolean(false);
@@ -297,7 +305,7 @@
public void testGtxLockedByGtxSuccess() throws InterruptedException
{
- final InvocationContextContainer icc = new InvocationContextContainer();
+ final InvocationContextContainer icc = getInvocationContextContainer();
final OwnableReentrantLock lock = new OwnableReentrantLock(icc);
final AtomicBoolean acquired = new AtomicBoolean(false);
GlobalTransaction gtx = new GlobalTransaction();
@@ -338,7 +346,7 @@
public void satisfyCodeCoverage() throws InterruptedException
{
- final InvocationContextContainer icc = new InvocationContextContainer();
+ final InvocationContextContainer icc = getInvocationContextContainer();
final OwnableReentrantLock lock = new OwnableReentrantLock(icc);
System.out.println(lock.toString());
lock.lockInterruptibly();
@@ -347,12 +355,12 @@
assert lock.newCondition() != null;
assert lock.isHeldExclusively();
lock.unlock();
- assert lock.isHeldExclusively();
+ assert !lock.isHeldExclusively();
}
public void testSerialization() throws IOException, ClassNotFoundException
{
- final InvocationContextContainer icc = new InvocationContextContainer();
+ final InvocationContextContainer icc = getInvocationContextContainer();
final OwnableReentrantLock lock = new OwnableReentrantLock(icc);
lock.lock();
assert lock.isLocked();
16 years, 6 months
JBoss Cache SVN: r6083 - core/trunk/src/main/resources/META-INF.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-06-27 03:49:41 -0400 (Fri, 27 Jun 2008)
New Revision: 6083
Added:
core/trunk/src/main/resources/META-INF/buddy-replication-cache-service.xml
core/trunk/src/main/resources/META-INF/cacheloader-enabled-cache-service.xml
core/trunk/src/main/resources/META-INF/eviction-enabled-cache-service.xml
core/trunk/src/main/resources/META-INF/local-cache-service.xml
core/trunk/src/main/resources/META-INF/multiplexer-enabled-cache-service.xml
core/trunk/src/main/resources/META-INF/optimistically-locked-cache-service.xml
Log:
migrated sample config files to new format.
Added: core/trunk/src/main/resources/META-INF/buddy-replication-cache-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/buddy-replication-cache-service.xml (rev 0)
+++ core/trunk/src/main/resources/META-INF/buddy-replication-cache-service.xml 2008-06-27 07:49:41 UTC (rev 6083)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!-- todo mmarkus add comments to sample config files (after DTD is written) -->
+
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <startup stateRetrievalTimeout="20000"/>
+ <transport clusterName="JBossCache-Cluster">
+ <jgroupsConfig>
+ <TCP discard_incompatible_packets="true" enable_bundling="true" enable_diagnostics="true"
+ enable_unicast_bundling="true" loopback="false" max_bundle_size="64000" max_bundle_timeout="30"
+ oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="4"
+ oob_thread_pool.min_threads="2" oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" recv_buf_size="20000000" thread_naming_pattern="pl"
+ thread_pool.enabled="true" thread_pool.keep_alive_time="30000" thread_pool.max_threads="4"
+ thread_pool.min_threads="1" thread_pool.queue_enabled="true" thread_pool.queue_max_size="50000"
+ thread_pool.rejection_policy="discard" use_concurrent_stack="true" use_incoming_packet_handler="true"
+ use_send_queues="false"/>
+ <MPING mcast_addr="232.1.2.3" num_initial_members="3" timeout="2000"/>
+ <MERGE2 max_interval="30000" min_interval="10000"/>
+ <FD_SOCK/>
+ <FD max_tries="5" shun="true" timeout="10000"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
+ use_mcast_xmit="false"/>
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/>
+ <pbcast.GMS join_retry_timeout="2000" join_timeout="5000" print_local_addr="true" shun="false"
+ view_ack_collection_timeout="5000" view_bundling="true"/>
+ <FC max_credits="5000000" min_threshold="0.20"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
+ <pbcast.FLUSH timeout="0"/>
+ </jgroupsConfig>
+ </transport>
+ <replication>
+ <sync replTimeout="15000"/>
+ <buddy enabled="true" poolName="myBuddyPoolReplicationGroup" communicationTimeout="2000">
+ <dataGravitation auto="false" removeOnFind="true" searchBackupTrees="true"/>
+ <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
+ <properties>
+ numBuddies = 1
+ ignoreColocatedBuddies = true
+ </properties>
+ </locator>
+ </buddy>
+ </replication>
+</jbosscache>
Added: core/trunk/src/main/resources/META-INF/cacheloader-enabled-cache-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/cacheloader-enabled-cache-service.xml (rev 0)
+++ core/trunk/src/main/resources/META-INF/cacheloader-enabled-cache-service.xml 2008-06-27 07:49:41 UTC (rev 6083)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <eviction wakeUpInterval="5000">
+ <defaults policyClass="org.jboss.cache.eviction.LRUPolicy" eventQueueSize="200000"/>
+ <root>
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">3</attribute>
+ </root>
+ <region name="/org/jboss/test/data">
+ <attribute name="maxNodes">100</attribute>
+ <attribute name="timeToLiveSeconds">3</attribute>
+ </region>
+ </eviction>
+ <loaders passivation="false" shared="false">
+ <preload>
+ <node fqn="/"/>
+ </preload>
+ <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="true"
+ ignoreModifications="false" purgeOnStartup="false">
+ <properties>
+ cache.jdbc.table.name=jbosscache
+ cache.jdbc.table.create=true
+ cache.jdbc.table.drop=true
+ cache.jdbc.table.primarykey=jbosscache_pk
+ cache.jdbc.fqn.column=fqn
+ cache.jdbc.fqn.type=varchar(255)
+ cache.jdbc.node.column=node
+ cache.jdbc.node.type=blob
+ cache.jdbc.parent.column=parent
+ cache.jdbc.driver=com.mysql.jdbc.Driver
+ cache.jdbc.url=jdbc:mysql://localhost:3306/jbossdb
+ cache.jdbc.user=root
+ cache.jdbc.password=
+ cache.jdbc.sql-concat=concat(1,2)
+ </properties>
+ </loader>
+ </loaders>
+</jbosscache>
Added: core/trunk/src/main/resources/META-INF/eviction-enabled-cache-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/eviction-enabled-cache-service.xml (rev 0)
+++ core/trunk/src/main/resources/META-INF/eviction-enabled-cache-service.xml 2008-06-27 07:49:41 UTC (rev 6083)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <eviction wakeUpInterval="5000">
+ <defaults policyClass="org.jboss.cache.eviction.LRUPolicy" eventQueueSize="200000"/>
+ <root>
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </root>
+ <region name="/org/jboss/data">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <region name="/org/jboss/test/data">
+ <attribute name="maxNodes">5</attribute>
+ <attribute name="timeToLiveSeconds">4</attribute>
+ </region>
+ <region name="/test">
+ <attribute name="maxNodes">10000</attribute>
+ <attribute name="timeToLiveSeconds">4</attribute>
+ </region>
+ <region name="/maxAgeTest">
+ <attribute name="maxNodes">10000</attribute>
+ <attribute name="timeToLiveSeconds">8</attribute>
+ <attribute name="maxAgeSeconds">10</attribute>
+ </region>
+ </eviction>
+</jbosscache>
Added: core/trunk/src/main/resources/META-INF/local-cache-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/local-cache-service.xml (rev 0)
+++ core/trunk/src/main/resources/META-INF/local-cache-service.xml 2008-06-27 07:49:41 UTC (rev 6083)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+</jbosscache>
Added: core/trunk/src/main/resources/META-INF/multiplexer-enabled-cache-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/multiplexer-enabled-cache-service.xml (rev 0)
+++ core/trunk/src/main/resources/META-INF/multiplexer-enabled-cache-service.xml 2008-06-27 07:49:41 UTC (rev 6083)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <startup stateRetrievalTimeout="20000"/>
+ <transport clusterName="JBossCache-Cluster" multiplexerStack="fc-fast-minimalthreads">
+ <jgroupsConfig>
+ <TCP recv_buf_size="20000000" use_send_queues="false" loopback="false" discard_incompatible_packets="true"
+ max_bundle_size="64000" max_bundle_timeout="30" use_incoming_packet_handler="true" enable_bundling="true"
+ enable_unicast_bundling="true" enable_diagnostics="true" use_concurrent_stack="true"
+ thread_naming_pattern="pl" thread_pool.enabled="true" thread_pool.min_threads="1"
+ thread_pool.max_threads="4" thread_pool.keep_alive_time="30000" thread_pool.queue_enabled="true"
+ thread_pool.queue_max_size="50000" thread_pool.rejection_policy="discard" oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="2" oob_thread_pool.max_threads="4" oob_thread_pool.keep_alive_time="10000"
+ oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run"/>
+ <MPING mcast_addr="232.1.2.3" timeout="2000" num_initial_members="3"/>
+ <MERGE2 max_interval="30000" min_interval="10000"/>
+ <FD_SOCK/>
+ <FD timeout="10000" max_tries="5" shun="true"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <pbcast.NAKACK use_mcast_xmit="false" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
+ discard_delivered_msgs="true"/>
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="400000"/>
+ <pbcast.GMS print_local_addr="true" join_timeout="5000" join_retry_timeout="2000" shun="false"
+ view_bundling="true" view_ack_collection_timeout="5000"/>
+ <FC max_credits="5000000" min_threshold="0.20"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER use_reading_thread="true"/>
+ <pbcast.FLUSH timeout="0"/>
+ </jgroupsConfig>
+ </transport>
+ <replication>
+ <sync replTimeout="15000"/>
+ <buddy enabled="true" poolName="myBuddyPoolReplicationGroup" communicationTimeout="2000">
+ <dataGravitation auto="false" removeOnFind="true" searchBackupTrees="true"/>
+ <locator class="org.jboss.cache.buddyreplication.NextMemberBuddyLocator">
+ <properties>
+ numBuddies = 1
+ ignoreColocatedBuddies = true
+ </properties>
+ </locator>
+ </buddy>
+ </replication>
+</jbosscache>
Added: core/trunk/src/main/resources/META-INF/optimistically-locked-cache-service.xml
===================================================================
--- core/trunk/src/main/resources/META-INF/optimistically-locked-cache-service.xml (rev 0)
+++ core/trunk/src/main/resources/META-INF/optimistically-locked-cache-service.xml 2008-06-27 07:49:41 UTC (rev 6083)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache>
+ <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="10000" nodeLockingScheme="Optimistic"/>
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
+ <startup fetchInMemoryState="false"/>
+ <eviction wakeUpInterval="1000">
+ <defaults policyClass="org.jboss.cache.eviction.LRUPolicy"/>
+ <root>
+ <attribute name="maxNodes">10</attribute>
+ <attribute name="timeToLiveSeconds">0</attribute>
+ <attribute name="maxAgeSeconds">0</attribute>
+ </root>
+ <region name="/testingRegion">
+ <attribute name="maxNodes">10</attribute>
+ <attribute name="timeToLiveSeconds">0</attribute>
+ <attribute name="maxAgeSeconds">0</attribute>
+ </region>
+ <region name="/timeBased">
+ <attribute name="maxNodes">10</attribute>
+ <attribute name="timeToLiveSeconds">1</attribute>
+ <attribute name="maxAgeSeconds">1</attribute>
+ </region>
+ </eviction>
+</jbosscache>
16 years, 6 months
JBoss Cache SVN: r6082 - in core/trunk/src/main: release and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-06-27 03:48:25 -0400 (Fri, 27 Jun 2008)
New Revision: 6082
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
core/trunk/src/main/release/build.xml
Log:
added ant support for transforming 2.x configuration files to 3.x configuration files
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java 2008-06-27 00:26:03 UTC (rev 6081)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/ConfigFilesConvertor.java 2008-06-27 07:48:25 UTC (rev 6082)
@@ -89,15 +89,31 @@
public static void main(String[] argv) throws Exception
{
- if (argv.length != 2)
+ String sourceName = System.getProperty("source");
+ if (sourceName == null)
{
- System.err.println("Usage: java Stylizer stylesheet xmlfile");
+ System.err.println("Missing property 'source'.");
System.exit(1);
}
- File datafile = new File(argv[1]);
+ String destinationName = System.getProperty("destination");
+ if (destinationName == null)
+ {
+ System.err.println("Missing property 'destination'.");
+ System.exit(1);
+ }
+ File oldConfig = new File(sourceName);
+ if (!oldConfig.exists())
+ {
+ System.err.println("File specified as input ('" + sourceName + ") does not exist.");
+ System.exit(1);
+ }
ConfigFilesConvertor convertor = new ConfigFilesConvertor();
- FileInputStream is = new FileInputStream(datafile);
- convertor.parse(is, System.out, argv[0]);
+ File destination = new File(destinationName);
+ if (!destination.exists()) destination.createNewFile();
+
+ FileInputStream is = new FileInputStream(oldConfig);
+ FileOutputStream fos = new FileOutputStream(destinationName);
+ convertor.parse(is, fos, "config2to3.xslt");
is.close();
}
}
\ No newline at end of file
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-06-27 00:26:03 UTC (rev 6081)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2008-06-27 07:48:25 UTC (rev 6082)
@@ -21,6 +21,7 @@
import java.util.Properties;
/**
+ * todo mmarkus comment classes
* @author Mircea.Markus(a)jboss.com
* @since 3.0
*/
Modified: core/trunk/src/main/release/build.xml
===================================================================
--- core/trunk/src/main/release/build.xml 2008-06-27 00:26:03 UTC (rev 6081)
+++ core/trunk/src/main/release/build.xml 2008-06-27 07:48:25 UTC (rev 6082)
@@ -22,7 +22,9 @@
<property name="jvm.mx" value="-Xms1024M"/>
<property name="demo.cfg.file" value="META-INF/total-replication-cache-service.xml"/>
+ <property environment="env"/>
+
<!-- Test if JDK5 is available -->
<available classname="java.lang.Enum" property="HAVE_JDK_1.5"/>
@@ -126,6 +128,13 @@
</testng>
</target>
+ <!-- todo mmarkus add a paragraph in documentation to mntion about this-->
+ <target name="config2to3">
+ <echo message="${os.name}"/>
+ <xslt in="${source}" out="${destination}" style="resources/config2to3.xslt"/>
+ </target>
+
+
<target name="run.tests" depends="compile" description="run TestNG test cases.">
<testng
outputDir="${reports}"
16 years, 6 months
JBoss Cache SVN: r6081 - in core/trunk/src: main/java/org/jboss/cache/commands/remote and 4 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-06-26 20:26:03 -0400 (Thu, 26 Jun 2008)
New Revision: 6081
Modified:
core/trunk/src/main/java/org/jboss/cache/DataContainer.java
core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/VersionedInvalidateCommand.java
core/trunk/src/test/java/org/jboss/cache/DataContainerTest.java
core/trunk/src/test/java/org/jboss/cache/commands/read/AbstractDataCommandTest.java
core/trunk/src/test/java/org/jboss/cache/commands/write/ClearDataCommandTest.java
core/trunk/src/test/java/org/jboss/cache/commands/write/EvictCommandTest.java
core/trunk/src/test/java/org/jboss/cache/commands/write/MoveCommandTest.java
core/trunk/src/test/java/org/jboss/cache/commands/write/RemoveNodeCommandTest.java
core/trunk/src/test/java/org/jboss/cache/commands/write/VersionedInvalidateCommandTest.java
Log:
Removed reliance on certain peek methods on DataContainer, preferring to use invocationContext.lookup() instead as it allows us to cache nodes in the context.
Modified: core/trunk/src/main/java/org/jboss/cache/DataContainer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainer.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainer.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -2,8 +2,6 @@
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.mvcc.InternalNode;
-import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.transaction.GlobalTransaction;
import java.util.List;
import java.util.Set;
@@ -41,40 +39,6 @@
NodeSPI peek(Fqn fqn);
/**
- * Finds a node given a fully qualified name and DataVersion. Does not include invalid or deleted nodes. If the data
- * version passed in is null, then data version checking is skipped. Data version checking is also skipped if optimistic
- * locking is not used.
- *
- * @param fqn fqn to find
- * @param version version of the node to find
- * @return a node, if found, or null if not.
- */
- NodeSPI peekVersioned(Fqn fqn, DataVersion version);
-
- /**
- * Similar to {@link #peekVersioned(Fqn, org.jboss.cache.optimistic.DataVersion)} except that it throws a {@link org.jboss.cache.NodeNotExistsException}
- * if the node cannot be found.
- *
- * @param gtx global transaction
- * @param fqn fqn to find
- * @param includeInvalid if true, invalid nodes are considered as well.
- * @return the node
- */
- NodeSPI peekStrict(GlobalTransaction gtx, Fqn fqn, boolean includeInvalid);
-
- /**
- * Searches for a specific node, with a specific data version and, optionally, invalid nodes as well, but not
- * deleted nodes. If the data version passed in is null, then data version checking is skipped. Data version
- * checking is also skipped if optimistic locking is not used.
- *
- * @param fqn Fqn to find
- * @param version version of the node to find
- * @param includeInvalidNodes if true, invalid nodes are considered
- * @return the node, if found, or null otherwise.
- */
- NodeSPI peekVersioned(Fqn fqn, DataVersion version, boolean includeInvalidNodes);
-
- /**
* Same as calling <tt>peek(fqn, includeDeletedNodes, false)</tt>.
*
* @param fqn Fqn to find
Modified: core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -3,7 +3,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
-import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.NonVolatile;
import org.jboss.cache.factories.annotations.Start;
@@ -12,8 +11,6 @@
import org.jboss.cache.lock.LockManager;
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.mvcc.InternalNode;
-import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.transaction.GlobalTransaction;
import java.util.ArrayList;
import java.util.Collections;
@@ -34,8 +31,6 @@
private static final Log log = LogFactory.getLog(DataContainerImpl.class);
private static boolean trace = log.isTraceEnabled();
- private Configuration configuration;
-
/**
* Root node.
*/
@@ -51,9 +46,9 @@
private BuddyFqnTransformer buddyFqnTransformer;
@Inject
- public void injectDependencies(Configuration configuration, NodeFactory nodeFactory, LockManager lockManager, BuddyFqnTransformer transformer)
+ public void injectDependencies(NodeFactory nodeFactory, LockManager lockManager, BuddyFqnTransformer transformer)
{
- setDependencies(configuration, nodeFactory, lockManager);
+ setDependencies(nodeFactory, lockManager);
// We need to create a root node even at this stage since certain components rely on this being available before
// start() is called.
@@ -63,9 +58,8 @@
this.buddyFqnTransformer = transformer;
}
- public void setDependencies(Configuration configuration, NodeFactory nodeFactory, LockManager lockManager)
+ public void setDependencies(NodeFactory nodeFactory, LockManager lockManager)
{
- this.configuration = configuration;
this.nodeFactory = nodeFactory;
this.lockManager = lockManager;
}
@@ -120,68 +114,11 @@
internalFqns.add(fqn);
}
- /**
- * Finds a node given a fully qualified name, directly off the interceptor chain. In the event of an exception,
- * returns null. Does not include invalid or deleted nodes.
- *
- * @param fqn Fully qualified name for the corresponding node.
- * @return Node referenced by the given Fqn, or null if the node cannot be found or if there is an exception.
- */
public NodeSPI peek(Fqn fqn)
{
- try
- {
- return peekVersioned(fqn, null);
- }
- catch (CacheException e)
- {
- log.warn("Unexpected error", e);
- return null;
- }
+ return peek(fqn, false, false);
}
- public NodeSPI peekStrict(GlobalTransaction gtx, Fqn fqn, boolean includeInvalid)
- {
- NodeSPI n = peekVersioned(fqn, null, includeInvalid);
- if (n == null)
- {
- StringBuilder builder = new StringBuilder();
- builder.append("Node ").append(fqn).append(" not found");
- String errStr = builder.toString();
- if (trace) log.trace(errStr);
- throw new NodeNotExistsException(errStr);
- }
- return n;
- }
-
- public NodeSPI peekVersioned(Fqn fqn, DataVersion version)
- {
- return peekVersioned(fqn, version, false);
- }
-
- public NodeSPI peekVersioned(Fqn fqn, DataVersion version, boolean includeInvalidNodes)
- {
- if (fqn == null) return null;
-
- NodeSPI toReturn = peek(fqn, false, includeInvalidNodes);
-
- if (toReturn != null && version != null && configuration.getNodeLockingScheme().isVersionedScheme())
- {
- // we need to check the version of the data node...
- DataVersion nodeVersion = toReturn.getVersion();
- if (trace)
- {
- log.trace("looking for optimistic node [" + fqn + "] with version [" + version + "]. My version is [" + nodeVersion + "]");
- }
- if (nodeVersion.newerThan(version))
- {
- // we have a versioning problem; throw an exception!
- throw new CacheException("Unable to validate versions.");
- }
- }
- return toReturn;
- }
-
public NodeSPI peek(Fqn<?> fqn, boolean includeDeletedNodes)
{
return peek(fqn, includeDeletedNodes, false);
@@ -476,7 +413,7 @@
private void removeNode(Fqn fqn)
{
- NodeSPI targetNode = peekVersioned(fqn, null, true);
+ NodeSPI targetNode = peek(fqn, false, true);
if (targetNode == null) return;
NodeSPI parentNode = targetNode.getParent();
targetNode.setValid(false, false);
@@ -489,7 +426,7 @@
protected void removeData(Fqn fqn)
{
- NodeSPI n = peekVersioned(fqn, null);
+ NodeSPI n = peek(fqn);
if (n == null)
{
log.warn("node " + fqn + " not found");
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -88,14 +88,14 @@
// if this is a DIRECT child of a DEAD buddy backup region, then remove the empty dead region structural node.
if (buddyFqnTransformer.isDeadBackupFqn(backup) && buddyFqnTransformer.isDeadBackupRoot(backup.getParent().getParent()))
{
- NodeSPI deadBackupRoot = dataContainer.peek(backup.getParent(), false);
+ NodeSPI deadBackupRoot = ctx.lookUpNode(backup.getParent());
if (deadBackupRoot.getChildrenMapDirect().isEmpty())
{
if (trace) log.trace("Removing dead backup region " + deadBackupRoot.getFqn());
executeRemove(gtx, deadBackupRoot.getFqn());
// now check the grand parent and see if we are free of versions
- deadBackupRoot = dataContainer.peek(deadBackupRoot.getFqn().getParent(), false);
+ deadBackupRoot = ctx.lookUpNode(deadBackupRoot.getFqn().getParent());
if (deadBackupRoot.getChildrenMapDirect().isEmpty())
{
if (trace) log.trace("Removing dead backup region " + deadBackupRoot.getFqn());
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/AbstractVersionedDataCommand.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -3,10 +3,13 @@
import org.jboss.cache.CacheException;
import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.VersionedDataCommand;
import org.jboss.cache.commands.read.AbstractDataCommand;
+import org.jboss.cache.invocation.InvocationContext;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.optimistic.DataVersioningException;
import org.jboss.cache.transaction.GlobalTransaction;
/**
@@ -97,4 +100,23 @@
{
return 31 * super.hashCode() + (dataVersion != null ? dataVersion.hashCode() : 0);
}
+
+ /**
+ * Utility method to peek a node and throw an exception if the version isn't what is expected.
+ *
+ * @param ctx context to use
+ * @return node peeked, null if nonexistent
+ * @throws org.jboss.cache.optimistic.DataVersioningException
+ * if there is a version mismatch
+ */
+ protected NodeSPI peekVersioned(InvocationContext ctx)
+ {
+ NodeSPI n = ctx.lookUpNode(fqn);
+ if (n != null && isVersioned() && n.getVersion().newerThan(dataVersion))
+ {
+ String errMsg = new StringBuilder("Node found, but version is not equal to or less than the expected [").append(dataVersion).append("]. Is [").append(n.getVersion()).append("] instead!").toString();
+ throw new DataVersioningException(errMsg);
+ }
+ return n;
+ }
}
\ No newline at end of file
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/ClearDataCommand.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -50,8 +50,7 @@
{
if (trace) log.trace("perform(" + globalTransaction + ", \"" + fqn + "\")");
- NodeSPI targetNode = dataContainer.peekVersioned(fqn, dataVersion);
-// NodeSPI targetNode = ctx.lookUpNode(fqn);
+ NodeSPI targetNode = peekVersioned(ctx);
if (targetNode == null)
{
log.warn("node " + fqn + " not found");
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/EvictCommand.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -50,12 +50,16 @@
*/
public Object perform(InvocationContext ctx)
{
- NodeSPI node = dataContainer.peek(fqn, false, false);
- if (node != null && node.isResident())
+ NodeSPI node = ctx.lookUpNode(fqn);
+ if (node == null)
{
+ return false;
+ }
+ else if (node.isResident())
+ {
return true;
}
- if (recursive)
+ else if (recursive)
{
List<Fqn> nodesToEvict = dataContainer.getNodesForEviction(fqn, true);
for (Fqn aFqn : nodesToEvict)
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -104,13 +104,13 @@
private void move(Fqn toMoveFqn, Fqn newParentFqn, boolean skipNotifications, InvocationContext ctx)
{
// the actual move algorithm.
- NodeSPI newParent = dataContainer.peek(newParentFqn, false, false);
+ NodeSPI newParent = ctx.lookUpNode(newParentFqn);
if (newParent == null)
{
throw new NodeNotExistsException("New parent node " + newParentFqn + " does not exist when attempting to move node!!");
}
- NodeSPI node = dataContainer.peek(toMoveFqn, false, false);
+ NodeSPI node = ctx.lookUpNode(toMoveFqn);
if (node == null)
{
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/PutKeyValueCommand.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -54,12 +54,8 @@
*/
public Object perform(InvocationContext ctx)
{
- if (trace)
- {
- log.trace(new StringBuffer("perform(").append(globalTransaction).append(", \"").
- append(fqn).append("\", k=").append(key).append(", v=").append(value).append(")"));
- }
-// NodeSPI n = dataContainer.peekStrict(globalTransaction, fqn, false);
+ if (trace) log.trace("Perform('" + globalTransaction + "', '" + fqn + "', k='" + key + "', v='" + value + "')");
+
NodeSPI n = ctx.lookUpNode(fqn);
if (n == null) throw new NodeNotExistsException("Node " + fqn + " does not exist!");
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/RemoveNodeCommand.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -47,8 +47,9 @@
public Object perform(InvocationContext ctx)
{
if (trace) log.trace("perform(" + globalTransaction + ", \"" + fqn + ")");
+
// Find the node
- targetNode = dataContainer.peekVersioned(fqn, dataVersion, true);
+ targetNode = peekVersioned(ctx);
if (targetNode == null)
{
if (trace) log.trace("node " + fqn + " not found");
Modified: core/trunk/src/main/java/org/jboss/cache/commands/write/VersionedInvalidateCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/write/VersionedInvalidateCommand.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/VersionedInvalidateCommand.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -9,6 +9,7 @@
import org.jboss.cache.config.Option;
import org.jboss.cache.invocation.InvocationContext;
import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.optimistic.DataVersioningException;
import org.jboss.cache.transaction.GlobalTransaction;
import javax.transaction.Transaction;
@@ -64,7 +65,7 @@
if (node == null)
{
// check if a tombstone already exists
- NodeSPI nodeSPI = dataContainer.peek(fqn, false, true);
+ NodeSPI nodeSPI = dataContainer.peek(fqn, true, true);
if (nodeSPI == null)
{
if (dataVersion == null)
@@ -78,9 +79,20 @@
}
node = nodeSPI;
}
- removeData(ctx);
+ else if (node.getVersion() == null)
+ {
+ throw new NullPointerException("Node " + node.getFqn() + " has a null data version, and is of type " + node.getClass().getSimpleName() + ". This command expects versioned nodes.");
+ }
+ else if (node.getVersion().newerThan(dataVersion))
+ {
+ String errMsg = new StringBuilder("Node found, but version is not equal to or less than the expected [").append(dataVersion).append("]. Is [").append(node.getVersion()).append("] instead!").toString();
+ log.warn(errMsg);
+ throw new DataVersioningException(errMsg);
+ }
+
+ removeData(node, ctx);
invalidateNode(node);
- updateDataVersion();
+ node.setVersion(dataVersion);
return null;
}
@@ -111,23 +123,8 @@
}
}
- private void updateDataVersion()
+ protected void removeData(NodeSPI n, InvocationContext ctx) throws CacheException
{
- if (dataVersion != null)
- {
- NodeSPI n = dataContainer.peek(fqn, false, true);
- n.setVersion(dataVersion);
- }
- }
-
- protected void removeData(InvocationContext ctx) throws CacheException
- {
- NodeSPI n = dataContainer.peekVersioned(fqn, dataVersion);
- if (n == null)
- {
- log.warn("node " + fqn + " not found");
- return;
- }
notifier.notifyNodeEvicted(fqn, true, ctx);
n.clearDataDirect();
n.setDataLoaded(false);
Modified: core/trunk/src/test/java/org/jboss/cache/DataContainerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/DataContainerTest.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/test/java/org/jboss/cache/DataContainerTest.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -1,11 +1,8 @@
package org.jboss.cache;
-import org.jboss.cache.config.Configuration;
+import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.mock.MockNodesFixture;
-import org.jboss.cache.optimistic.DataVersion;
-import org.jboss.cache.optimistic.DefaultDataVersion;
-import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -67,56 +64,6 @@
}
/**
- * tests {@link DataContainerImpl#peekVersioned(Fqn, org.jboss.cache.optimistic.DataVersion, boolean)} method.
- */
- public void testPeekVersioned()
- {
- assert nodes.adfgNode == container.peekVersioned(nodes.adfg, null, true) : "if data version is null this returns same value as peek(boolean, boolean)";
-
- //test pessimistic loking
- Configuration config = new Configuration();
- config.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
- DataVersion dataVersion = new DefaultDataVersion(2);
- container.setDependencies(config, null, null);
- assert nodes.adfgNode == container.peekVersioned(nodes.adfg, dataVersion, true) : "if NOT opt locking same value as peek(boolean, boolean) expected";
-
- //test optimistic locking with same version
- config.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
- DataVersion adfgDataVersion = new DefaultDataVersion(2);
- nodes.adfgNode.setVersion(adfgDataVersion);
- assert nodes.adfgNode == container.peekVersioned(nodes.adfg, adfgDataVersion, true) : "same version, expcting node to be returned";
-
- //test optimistic locking with a an older
- try
- {
- container.peekVersioned(nodes.adfg, new DefaultDataVersion(1), true);
- assert false : "exception expected as version changed.";
- }
- catch (CacheException e)
- {
- //expected
- }
- }
-
- /**
- * tests {@link DataContainerImpl#peekStrict(org.jboss.cache.transaction.GlobalTransaction, Fqn, boolean)}.
- */
- public void testPeekStrict()
- {
- assert nodes.adfgNode == container.peekStrict(null, nodes.adfg, true) : "if data version is null this returns same value as peek(boolean, boolean)";
-
- try
- {
- container.peekStrict(null, nodes.notExistent, true);
- assert false : "excpetion expected as node does not exist";
- }
- catch (Exception e)
- {
- //expected
- }
- }
-
- /**
* tests {@link DataContainerImpl#exists(Fqn)}
*/
public void testsExists()
Modified: core/trunk/src/test/java/org/jboss/cache/commands/read/AbstractDataCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/read/AbstractDataCommandTest.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/test/java/org/jboss/cache/commands/read/AbstractDataCommandTest.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -25,8 +25,8 @@
final public void setUp()
{
container = createMock(DataContainer.class);
+ moreSetup();
ctx = createLegacyInvocationContext(container);
- moreSetup();
}
/**
Modified: core/trunk/src/test/java/org/jboss/cache/commands/write/ClearDataCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/write/ClearDataCommandTest.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/test/java/org/jboss/cache/commands/write/ClearDataCommandTest.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -1,8 +1,8 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.expect;
+import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.testng.annotations.Test;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
import java.util.Collections;
@@ -12,7 +12,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-@Test (groups = "unit")
+@Test(groups = "unit")
public class ClearDataCommandTest extends AbstractVersionedDataCommandTest
{
@@ -27,16 +27,17 @@
public void testNonexistentNode()
{
- expect(container.peekVersioned(fqn, dataVersion)).andReturn(null);
+ expect(container.peek(fqn)).andReturn(null);
control.replay();
assert null == command.perform(ctx);
control.verify();
}
- public void testExistentData()
+ public void testExistentDataVersioned()
{
nodes.adfgNode.put("key", "value");
- expect(container.peekVersioned(fqn, dataVersion)).andReturn(nodes.adfgNode);
+ nodes.adfgNode.setVersion(dataVersion);
+ expect(container.peek(fqn)).andReturn(nodes.adfgNode);
notifier.notifyNodeModified(fqn, true, NodeModifiedEvent.ModificationType.REMOVE_DATA, nodes.adfgNode.getDataDirect(), ctx);
notifier.notifyNodeModified(fqn, false, NodeModifiedEvent.ModificationType.REMOVE_DATA, Collections.EMPTY_MAP, ctx);
control.replay();
@@ -53,6 +54,27 @@
assert nodes.aNode.getData().get("key").equals("value");
}
+ public void testExistentDataUnversioned()
+ {
+ command.setDataVersion(null);
+ nodes.adfgNode.put("key", "value");
+ expect(container.peek(fqn)).andReturn(nodes.adfgNode);
+ notifier.notifyNodeModified(fqn, true, NodeModifiedEvent.ModificationType.REMOVE_DATA, nodes.adfgNode.getDataDirect(), ctx);
+ notifier.notifyNodeModified(fqn, false, NodeModifiedEvent.ModificationType.REMOVE_DATA, Collections.EMPTY_MAP, ctx);
+ control.replay();
+ assert null == command.perform(ctx);
+ assert nodes.adfgNode.getData().isEmpty();
+ control.verify();
+
+ //now do a rollback
+ control.reset();
+ expect(container.peek(fqn, false, true)).andReturn(nodes.aNode);
+ control.replay();
+ command.rollback();
+ assert nodes.aNode.dataSize() == 1;
+ assert nodes.aNode.getData().get("key").equals("value");
+ }
+
/**
* If clearing data on an inexistent node, the rollback should not fail
*/
@@ -63,9 +85,10 @@
try
{
command.rollback();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
- assert false : "should not fail but expect this scenarion";
+ assert false : "should not fail but expect this scenarion";
}
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/commands/write/EvictCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/write/EvictCommandTest.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/test/java/org/jboss/cache/commands/write/EvictCommandTest.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -1,16 +1,17 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.createStrictControl;
+import static org.easymock.EasyMock.expect;
import org.easymock.IMocksControl;
-import org.testng.annotations.Test;
+import org.jboss.cache.DataContainer;
+import org.jboss.cache.Fqn;
import org.jboss.cache.commands.read.AbstractDataCommandTest;
+import org.jboss.cache.mock.MockNodesFixture;
import org.jboss.cache.notifications.Notifier;
-import org.jboss.cache.mock.MockNodesFixture;
-import org.jboss.cache.DataContainer;
-import org.jboss.cache.Fqn;
+import org.testng.annotations.Test;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
/**
* tester class for {@link EvictCommand}
@@ -39,7 +40,7 @@
public void testResidentNodesEviction()
{
nodes.abNode.setResident(true);
- expect(container.peek(testFqn, false,false)).andReturn(nodes.abNode);
+ expect(container.peek(testFqn)).andReturn(nodes.abNode);
control.replay();
assert Boolean.TRUE == command.perform(ctx);
control.verify();
@@ -47,7 +48,7 @@
public void testSimpleEviction()
{
- expect(container.peek(testFqn, false,false)).andReturn(nodes.abNode);
+ expect(container.peek(testFqn)).andReturn(nodes.abNode);
notifier.notifyNodeEvicted(testFqn, true, ctx);
expect(container.evict(testFqn)).andReturn(true);
notifier.notifyNodeEvicted(testFqn, false, ctx);
@@ -62,7 +63,7 @@
nodesToEvict.add(nodes.a);
nodesToEvict.add(nodes.ab);
command.setRecursive(true);
- expect(container.peek(testFqn, false,false)).andReturn(nodes.aNode);
+ expect(container.peek(testFqn)).andReturn(nodes.aNode);
expect(container.getNodesForEviction(testFqn, true)).andReturn(nodesToEvict);
control.checkOrder(false);
Modified: core/trunk/src/test/java/org/jboss/cache/commands/write/MoveCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/write/MoveCommandTest.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/test/java/org/jboss/cache/commands/write/MoveCommandTest.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -41,8 +41,8 @@
public void testFailsOnMissingSource()
{
control.checkOrder(false);
- expect(container.peek(source, false, false)).andReturn(null);
- expect(container.peek(destination, false, false)).andReturn(nodes.adfgNode);
+ expect(container.peek(source)).andReturn(null);
+ expect(container.peek(destination)).andReturn(nodes.adfgNode);
control.replay();
try
{
@@ -58,8 +58,8 @@
public void testFailsOnMissingDestination()
{
control.checkOrder(false);
- expect(container.peek(source, false, false)).andReturn(nodes.adfgNode);
- expect(container.peek(destination, false, false)).andReturn(null);
+ expect(container.peek(source)).andReturn(nodes.adfgNode);
+ expect(container.peek(destination)).andReturn(null);
control.replay();
try
{
Modified: core/trunk/src/test/java/org/jboss/cache/commands/write/RemoveNodeCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/write/RemoveNodeCommandTest.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/test/java/org/jboss/cache/commands/write/RemoveNodeCommandTest.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -1,8 +1,8 @@
package org.jboss.cache.commands.write;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.expect;
+import org.jboss.cache.transaction.GlobalTransaction;
import org.testng.annotations.Test;
-import org.jboss.cache.transaction.GlobalTransaction;
/**
* tester for {@link RemoveNodeCommand}.
@@ -24,7 +24,7 @@
public void testNonExistentNode()
{
- expect(container.peekVersioned(fqn, dataVersion, true)).andReturn(null);
+ expect(container.peek(fqn)).andReturn(null);
control.replay();
assert Boolean.FALSE == command.perform(ctx) : "nonexistent node was not remove; false expected";
}
@@ -33,11 +33,12 @@
{
//aditional setup
command.setSkipSendingNodeEvents(true); //no notification
- nodes.adfNode.put("akey","avalue");
+ nodes.adfNode.put("akey", "avalue");
+ nodes.adfNode.setVersion(dataVersion);
ctx.setGlobalTransaction(new GlobalTransaction());
//check perform
- expect(container.peekVersioned(fqn, dataVersion, true)).andReturn(nodes.adfNode);
+ expect(container.peek(fqn)).andReturn(nodes.adfNode);
control.replay();
assert Boolean.TRUE == command.perform(ctx);
assert nodes.adfgNode.isDeleted();
@@ -53,24 +54,27 @@
command.rollback();
assert nodes.adNode.hasChild("f");
}
+
public void testRemovalNoNotificationsInvalidNode()
{
command.setSkipSendingNodeEvents(true); //no notification
nodes.adfNode.setValid(false, false); //invalid node
-
- expect(container.peekVersioned(fqn, dataVersion, true)).andReturn(nodes.adfNode);
+ nodes.adfNode.setVersion(dataVersion);
+
+ expect(container.peek(fqn)).andReturn(nodes.adfNode);
control.replay();
assert Boolean.FALSE == command.perform(ctx);
assert nodes.adfgNode.isDeleted();
assert nodes.adfhNode.isDeleted();
control.verify();
}
-
+
public void testRemovalWithNotificationsInvalidNode()
{
nodes.adfNode.setValid(false, false); //invalid node
+ nodes.adfNode.setVersion(dataVersion);
- expect(container.peekVersioned(fqn, dataVersion, true)).andReturn(nodes.adfNode);
+ expect(container.peek(fqn)).andReturn(nodes.adfNode);
notifier.notifyNodeRemoved(fqn, true, nodes.adfNode.getDataDirect(), ctx);
notifier.notifyNodeRemoved(fqn, false, null, ctx);
control.replay();
Modified: core/trunk/src/test/java/org/jboss/cache/commands/write/VersionedInvalidateCommandTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/commands/write/VersionedInvalidateCommandTest.java 2008-06-27 00:17:00 UTC (rev 6080)
+++ core/trunk/src/test/java/org/jboss/cache/commands/write/VersionedInvalidateCommandTest.java 2008-06-27 00:26:03 UTC (rev 6081)
@@ -9,6 +9,7 @@
import org.jboss.cache.mock.MockNodesFixture;
import org.jboss.cache.notifications.Notifier;
import org.jboss.cache.optimistic.DataVersion;
+import org.jboss.cache.optimistic.DataVersioningException;
import org.jboss.cache.optimistic.DefaultDataVersion;
import org.testng.annotations.Test;
@@ -54,12 +55,11 @@
public void testWithExistingNode()
{
nodes.adfNode.put("key", "value");
+ nodes.adfNode.setVersion(dataVersion);
nodes.adfNode.setDataLoaded(true);
expect(spiMock.getNode(testFqn)).andReturn(nodes.adfNode);
- expect(container.peekVersioned(testFqn, dataVersion)).andReturn(nodes.adfNode);
notifier.notifyNodeEvicted(testFqn, true, ctx);
notifier.notifyNodeEvicted(testFqn, false, ctx);
- expect(container.peek(testFqn, false, true)).andReturn(nodes.adfNode);
control.replay();
assert null == command.perform(ctx);
@@ -75,8 +75,8 @@
{
nodes.adfNode.put("key", "value");
nodes.adfNode.setDataLoaded(true);
+ nodes.adfNode.setVersion(new DefaultDataVersion(100));
expect(spiMock.getNode(testFqn)).andReturn(nodes.adfNode);
- expect(container.peekVersioned(testFqn, dataVersion)).andThrow(new RuntimeException());
control.replay();
try
@@ -84,7 +84,7 @@
command.perform(ctx);
assert false : "exception expected";
}
- catch (Exception e)
+ catch (DataVersioningException e)
{
//expected as there is a version mismatch
}
@@ -96,15 +96,14 @@
control.verify();
}
- public void testExistingTumbstone()
+ public void testExistingTombstone()
{
nodes.adfNode.setValid(false, true);
+ nodes.adfNode.setVersion(dataVersion);
expect(spiMock.getNode(testFqn)).andReturn(null);
- expect(container.peek(testFqn, false, true)).andReturn(nodes.adfNode);
- expect(container.peekVersioned(testFqn, dataVersion)).andReturn(nodes.adfNode);
+ expect(container.peek(testFqn, true, true)).andReturn(nodes.adfNode);
notifier.notifyNodeEvicted(testFqn, true, ctx);
notifier.notifyNodeEvicted(testFqn, false, ctx);
- expect(container.peek(testFqn, false, true)).andReturn(nodes.adfNode);
control.replay();
assert null == command.perform(ctx);
16 years, 6 months