JBoss Cache SVN: r6332 - benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/lib.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-18 11:00:44 -0400 (Fri, 18 Jul 2008)
New Revision: 6332
Modified:
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/lib/jbosscache-core.jar
Log:
Modified: benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/lib/jbosscache-core.jar
===================================================================
(Binary files differ)
17 years, 5 months
JBoss Cache SVN: r6331 - in core/trunk/src/main/java/org/jboss/cache: mvcc and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-18 10:56:49 -0400 (Fri, 18 Jul 2008)
New Revision: 6331
Modified:
core/trunk/src/main/java/org/jboss/cache/AbstractNodeFactory.java
core/trunk/src/main/java/org/jboss/cache/NodeFactory.java
core/trunk/src/main/java/org/jboss/cache/PessimisticNodeFactory.java
core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeFactory.java
core/trunk/src/main/java/org/jboss/cache/optimistic/OptimisticNodeFactory.java
core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
Log:
* Performance tweaks around now data in nodes are populated
* Better NodeFactory interface
* Safer node constructors
Modified: core/trunk/src/main/java/org/jboss/cache/AbstractNodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/AbstractNodeFactory.java 2008-07-18 14:22:57 UTC (rev 6330)
+++ core/trunk/src/main/java/org/jboss/cache/AbstractNodeFactory.java 2008-07-18 14:56:49 UTC (rev 6331)
@@ -56,10 +56,8 @@
this.lockStrategyFactory = lockStrategyFactory;
}
- public NodeSPI<K, V> createNode(Object childName, Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data, boolean mapSafe)
+ private NodeSPI<K, V> initializeNodeInvocationDelegate(UnversionedNode<K, V> internal)
{
- UnversionedNode<K, V> internal = createInternalNode(childName, fqn, parent, data, mapSafe);
-
// always assume that new nodes do not have data loaded
internal.setDataLoaded(false);
NodeSPI<K, V> nid = createNodeInvocationDelegate(internal, false);
@@ -69,8 +67,32 @@
return nid;
}
- protected UnversionedNode<K, V> createInternalNode(Object childName, Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data, boolean mapSafe)
+ public NodeSPI<K, V> createNode(Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data)
{
+ UnversionedNode<K, V> internal = createInternalNode(fqn.getLastElement(), fqn, parent, data);
+ return initializeNodeInvocationDelegate(internal);
+ }
+
+ public NodeSPI<K, V> createNode(Object childName, NodeSPI<K, V> parent, Map<K, V> data)
+ {
+ UnversionedNode<K, V> internal = createInternalNode(childName, Fqn.fromRelativeElements(parent.getFqn(), childName), parent, data);
+ return initializeNodeInvocationDelegate(internal);
+ }
+
+ public NodeSPI<K, V> createNode(Fqn fqn, NodeSPI<K, V> parent)
+ {
+ UnversionedNode<K, V> internal = createInternalNode(fqn.getLastElement(), fqn, parent, null);
+ return initializeNodeInvocationDelegate(internal);
+ }
+
+ public NodeSPI<K, V> createNode(Object childName, NodeSPI<K, V> parent)
+ {
+ UnversionedNode<K, V> internal = createInternalNode(childName, Fqn.fromRelativeElements(parent.getFqn(), childName), parent, null);
+ return initializeNodeInvocationDelegate(internal);
+ }
+
+ protected UnversionedNode<K, V> createInternalNode(Object childName, Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data)
+ {
throw new UnsupportedOperationException("Unsupported in this implementation (" + getClass().getSimpleName() + ")!");
}
@@ -86,7 +108,7 @@
public NodeSPI<K, V> createRootNode()
{
- return createNode(null, Fqn.ROOT, null, null, false);
+ return createNode(Fqn.ROOT, null);
}
public NodeSPI<K, V> createNodeInvocationDelegate(InternalNode<K, V> internalNode, boolean wrapWithNodeReference)
Modified: core/trunk/src/main/java/org/jboss/cache/NodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/NodeFactory.java 2008-07-18 14:22:57 UTC (rev 6330)
+++ core/trunk/src/main/java/org/jboss/cache/NodeFactory.java 2008-07-18 14:56:49 UTC (rev 6331)
@@ -19,8 +19,50 @@
WorkspaceNode<K, V> createWrappedNode(NodeSPI<K, V> dataNode, TransactionWorkspace workspace);
- NodeSPI<K, V> createNode(Object childName, Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data, boolean mapSafe);
+ /**
+ * Creates a new node and populates its attributes.
+ * <p/>
+ * Note that the data map passed in must not be null, and must not be referenced anywhere else as a defensive copy
+ * is NOT made when injecting it into the node.
+ *
+ * @param fqn
+ * @param parent
+ * @param data
+ * @return
+ */
+ NodeSPI<K, V> createNode(Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data);
+ /**
+ * Creates a new node and populates its attributes.
+ * <p/>
+ * Note that the data map passed in must not be null, and must not be referenced anywhere else as a defensive copy
+ * is NOT made when injecting it into the node.
+ *
+ * @param childName
+ * @param parent
+ * @param data
+ * @return
+ */
+ NodeSPI<K, V> createNode(Object childName, NodeSPI<K, V> parent, Map<K, V> data);
+
+ /**
+ * Creates a new, empty node.
+ *
+ * @param fqn
+ * @param parent
+ * @return
+ */
+ NodeSPI<K, V> createNode(Fqn fqn, NodeSPI<K, V> parent);
+
+ /**
+ * Creates a new, empty node.
+ *
+ * @param childName
+ * @param parent
+ * @return
+ */
+ NodeSPI<K, V> createNode(Object childName, NodeSPI<K, V> parent);
+
NodeSPI<K, V> createRootNode();
NodeSPI<K, V> createNodeInvocationDelegate(InternalNode<K, V> internalNode, boolean wrapWithNodeReference);
Modified: core/trunk/src/main/java/org/jboss/cache/PessimisticNodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/PessimisticNodeFactory.java 2008-07-18 14:22:57 UTC (rev 6330)
+++ core/trunk/src/main/java/org/jboss/cache/PessimisticNodeFactory.java 2008-07-18 14:56:49 UTC (rev 6331)
@@ -11,7 +11,7 @@
public class PessimisticNodeFactory<K, V> extends AbstractNodeFactory<K, V>
{
@Override
- protected UnversionedNode<K, V> createInternalNode(Object childName, Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data, boolean mapSafe)
+ protected UnversionedNode<K, V> createInternalNode(Object childName, Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data)
{
PessimisticUnversionedNode<K, V> internal = new PessimisticUnversionedNode<K, V>(childName, fqn, data, cache);
internal.injectDependencies(cache, commandsFactory, lockStrategyFactory, this);
Modified: core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2008-07-18 14:22:57 UTC (rev 6330)
+++ core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2008-07-18 14:56:49 UTC (rev 6331)
@@ -5,6 +5,7 @@
import org.jboss.cache.lock.IdentityLock;
import org.jboss.cache.transaction.GlobalTransaction;
+import java.util.HashMap;
import java.util.Map;
/**
@@ -22,9 +23,17 @@
*/
protected transient IdentityLock lock = null;
- public PessimisticUnversionedNode(Object name, Fqn fqn, Map data, CacheSPI<K, V> cache)
+ public PessimisticUnversionedNode(Object name, Fqn fqn, Map<K, V> data, CacheSPI<K, V> cache)
{
- super(name, fqn, data, cache);
+ super(fqn, cache);
+ if (!fqn.isRoot() && !name.equals(fqn.getLastElement()))
+ throw new IllegalArgumentException("Child " + name + " must be last part of " + fqn);
+
+
+ if (data != null && !data.isEmpty())
+ setInternalState(data);
+ else
+ this.data = new HashMap<K, V>();
}
// ------ lock-per-node paradigm
@@ -94,7 +103,7 @@
// construct the new child outside the synchronized block to avoid
// spending any more time than necessary in the synchronized section
Fqn childFqn = Fqn.fromRelativeElements(fqn, childName);
- NodeSPI<K, V> newChild = nodeFactory.createNode(childName, childFqn, delegate, null, true);
+ NodeSPI<K, V> newChild = nodeFactory.createNode(childFqn, delegate);
if (newChild == null)
{
throw new IllegalStateException();
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-18 14:22:57 UTC (rev 6330)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-18 14:56:49 UTC (rev 6331)
@@ -50,7 +50,7 @@
/**
* Map of general data keys to values.
*/
- final Map<K, V> data = new HashMap<K, V>();
+ protected HashMap<K, V> data;
protected NodeSPI<K, V> delegate;
CommandsFactory commandsFactory;
@@ -77,40 +77,23 @@
initFlags();
}
- /**
- * Constructs a new node with a name, etc.
- *
- * @param name name of current node
- * @param fqn Fqn of current node
- * @param data data to add to node
- * @param cache cache reference
- */
- @SuppressWarnings("unchecked")
- public UnversionedNode(Object name, Fqn fqn, Map data, CacheSPI<K, V> cache)
+ public UnversionedNode(Fqn fqn, CacheSPI<K, V> cache)
{
- if (cache == null)
- {
- throw new IllegalArgumentException("no cache init for " + fqn);
- }
- if (!fqn.isRoot() && !name.equals(fqn.getLastElement()))
- {
- throw new IllegalArgumentException("Child " + name + " must be last part of " + fqn);
- }
-
+ if (cache == null) throw new IllegalArgumentException("no cache init for " + fqn);
initFlags();
this.cache = cache;
this.fqn = fqn;
-
init();
- if (data != null && !data.isEmpty()) setInternalState(data);
-
// if this is a root node, create the child map.
- if (fqn.isRoot())
- {
- children = new ConcurrentHashMap<Object, Node<K, V>>(64, .5f, 16);
- }
+ if (fqn.isRoot()) children = new ConcurrentHashMap<Object, Node<K, V>>(64, .5f, 16);
}
+ public UnversionedNode(Fqn fqn, CacheSPI<K, V> cache, Map<K, V> data)
+ {
+ this(fqn, cache);
+ if (data != null) this.data = new HashMap<K, V>(data);
+ }
+
/**
* This method initialises flags on the node, by setting DATA_LOADED to true and VALID to true and all other flags to false.
* The flags are defined in the {@link NodeFlags} enum.
@@ -176,6 +159,12 @@
}
}
+ // does not need to be synchronized since this will only be accessed by a single thread in MVCC thanks to the write lock.
+ private void initDataMap()
+ {
+ if (data == null) data = new HashMap<K, V>();
+ }
+
public CacheSPI<K, V> getCache()
{
return cache;
@@ -205,7 +194,7 @@
public V getDirect(K key)
{
- return data.get(key);
+ return data == null ? null : data.get(key);
}
@SuppressWarnings("deprecation")
@@ -228,6 +217,7 @@
public V putDirect(K key, V value)
{
+ if (data == null) initDataMap();
return data.put(key, value);
}
@@ -249,7 +239,7 @@
if (createIfNotExists && child == null)
{
Fqn childFqn = Fqn.fromRelativeElements(fqn, childName);
- NodeSPI<K, V> newChild = nodeFactory.createNode(childName, childFqn, delegate, null, true);
+ NodeSPI<K, V> newChild = nodeFactory.createNode(childFqn, delegate);
child = (NodeSPI<K, V>) children().putIfAbsent(childName, newChild);
@@ -511,7 +501,7 @@
public void putAllDirect(Map<K, V> data)
{
- if (data == null) return;
+ if (this.data == null) initDataMap();
this.data.putAll(data);
}
@@ -709,9 +699,11 @@
setFlag(LOCK_FOR_CHILD_INSERT_REMOVE, lockForChildInsertRemove);
}
+ @SuppressWarnings("unchecked")
public InternalNode<K, V> copy()
{
- UnversionedNode<K, V> n = new UnversionedNode<K, V>(fqn.getLastElement(), fqn, data, cache);
+ UnversionedNode<K, V> n = new UnversionedNode<K, V>(fqn, cache);
+ if (data != null) n.data = (HashMap<K, V>) data.clone();
copyInternals(n);
return n;
}
@@ -729,8 +721,15 @@
public void setInternalState(Map<K, V> state)
{
- // don't bother doing anything here
- putAllDirect(state);
+ if (data == null)
+ {
+ data = state == null ? new HashMap<K, V>() : new HashMap<K, V>(state);
+ }
+ else
+ {
+ // don't bother doing anything here
+ putAllDirect(state);
+ }
}
public Map<K, V> getInternalState(boolean onlyInternalState)
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeFactory.java 2008-07-18 14:22:57 UTC (rev 6330)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeFactory.java 2008-07-18 14:56:49 UTC (rev 6331)
@@ -49,10 +49,8 @@
return rcn;
}
- @Override
- public NodeSPI<K, V> createNode(Object childName, Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data, boolean mapSafe)
+ private NodeSPI<K, V> initializeNodeInvocationDelegate(UnversionedNode<K, V> internal)
{
- UnversionedNode<K, V> internal = new UnversionedNode<K, V>(childName, fqn, data, cache);
internal.injectDependencies(cache, commandsFactory, lockStrategyFactory, this);
// always assume that new nodes do not have data loaded
@@ -65,6 +63,32 @@
}
@Override
+ public NodeSPI<K, V> createNode(Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data)
+ {
+ UnversionedNode<K, V> internal = new UnversionedNode<K, V>(fqn, cache, data);
+ return initializeNodeInvocationDelegate(internal);
+ }
+
+ @Override
+ public NodeSPI<K, V> createNode(Fqn fqn, NodeSPI<K, V> parent)
+ {
+ UnversionedNode<K, V> internal = new UnversionedNode<K, V>(fqn, cache);
+ return initializeNodeInvocationDelegate(internal);
+ }
+
+ @Override
+ public NodeSPI<K, V> createNode(Object childName, NodeSPI<K, V> parent, Map<K, V> data)
+ {
+ return createNode(Fqn.fromRelativeElements(parent.getFqn(), childName), parent, data);
+ }
+
+ @Override
+ public NodeSPI<K, V> createNode(Object childName, NodeSPI<K, V> parent)
+ {
+ return createNode(Fqn.fromRelativeElements(parent.getFqn(), childName), parent);
+ }
+
+ @Override
public NodeSPI<K, V> createNodeInvocationDelegate(InternalNode<K, V> internalNode, boolean wrapWithNodeReference)
{
if (wrapWithNodeReference && internalNode instanceof NodeReference)
Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/OptimisticNodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/OptimisticNodeFactory.java 2008-07-18 14:22:57 UTC (rev 6330)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/OptimisticNodeFactory.java 2008-07-18 14:56:49 UTC (rev 6331)
@@ -17,7 +17,7 @@
public class OptimisticNodeFactory<K, V> extends AbstractNodeFactory<K, V>
{
@Override
- protected UnversionedNode<K, V> createInternalNode(Object childName, Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data, boolean mapSafe)
+ protected UnversionedNode<K, V> createInternalNode(Object childName, Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data)
{
VersionedNode<K, V> internal = new VersionedNode<K, V>(fqn, parent, data, cache);
internal.injectDependencies(cache, commandsFactory, lockStrategyFactory, this);
Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-07-18 14:22:57 UTC (rev 6330)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-07-18 14:56:49 UTC (rev 6331)
@@ -238,7 +238,7 @@
return null;
}
- NodeSPI<K, V> child = nodeFactory.createNode(childName, Fqn.fromRelativeElements(parent.getFqn(), childName), parent, null, true);
+ NodeSPI<K, V> child = nodeFactory.createNode(childName, parent);
getChildrenAddedSet().add(child.getFqn());
if (childrenRemoved != null) childrenRemoved.remove(child.getFqn());
setFlag(CHILDREN_MODIFIED_IN_WORKSPACE);
Modified: core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-07-18 14:22:57 UTC (rev 6330)
+++ core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java 2008-07-18 14:56:49 UTC (rev 6331)
@@ -283,7 +283,6 @@
int target_level = parent_level + 1;
Fqn fqn;
int size;
- Object name;
NodeData nd = nodeDataIterator.hasNext() ? nodeDataIterator.next() : null;
while (nd != null && !nd.isMarker())
{
@@ -304,14 +303,12 @@
throw new IllegalStateException("NodeData " + fqn + " is not a direct child of " + parent.getFqn());
}
- name = fqn.get(size - 1);
-
Map attrs = nd.getAttributes();
// We handle this NodeData. Create a TreeNode and
// integrate its data
- NodeSPI target = factory.createNode(name, fqn, parent, attrs, false);
- parent.addChild(name, target);
+ NodeSPI target = factory.createNode(fqn, parent, attrs);
+ parent.addChild(fqn.getLastElement(), target);
// JBCACHE-913
Region region = cache.getRegion(fqn, false);
@@ -406,7 +403,7 @@
// Missing level -- have to create empty node
// This shouldn't really happen -- internal fqns should
// be immediately under the root
- child = factory.createNode(name, Fqn.fromRelativeElements(ancFqn, name), ancestor, null, true);
+ child = factory.createNode(name, ancestor);
ancestor.addChild(name, child);
}
17 years, 5 months
JBoss Cache SVN: r6330 - benchmarks/benchmark-fwk/trunk.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-18 10:22:57 -0400 (Fri, 18 Jul 2008)
New Revision: 6330
Modified:
benchmarks/benchmark-fwk/trunk/runNode.sh
Log:
fixed typo
Modified: benchmarks/benchmark-fwk/trunk/runNode.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/runNode.sh 2008-07-18 12:36:52 UTC (rev 6329)
+++ benchmarks/benchmark-fwk/trunk/runNode.sh 2008-07-18 14:22:57 UTC (rev 6330)
@@ -49,7 +49,7 @@
. ./bindAddress.sh
echo bind address exit code is $?
-JVM_OPTIONS="${JVM_OPTIONS} -DcacheBenchFwk.cachePrioductName=${CACHE_PRODUCT} -Dbind.address=${BIND_ADDRESS} -DcacheBenchFwk.cacheConfigFile=${TEST_CFG} -DcurrentIndex=${CURRENT_INDEX} -DclusterSize=${CLUSTER_SIZE} -Djava.net.preferIPv4Stack=${preferIPv4Stack}"
+JVM_OPTIONS="${JVM_OPTIONS} -DcacheBenchFwk.cacheProductName=${CACHE_PRODUCT} -Dbind.address=${BIND_ADDRESS} -DcacheBenchFwk.cacheConfigFile=${TEST_CFG} -DcurrentIndex=${CURRENT_INDEX} -DclusterSize=${CLUSTER_SIZE} -Djava.net.preferIPv4Stack=${preferIPv4Stack}"
TO_EXECUTE="java $JVM_OPTIONS -cp $CLASSPATH org.cachebench.CacheBenchmarkRunner"
if [ "$DEBUG" = "debug" ]
17 years, 5 months
JBoss Cache SVN: r6329 - in core/trunk/src/main/java/org/jboss/cache: optimistic and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-18 08:36:52 -0400 (Fri, 18 Jul 2008)
New Revision: 6329
Modified:
core/trunk/src/main/java/org/jboss/cache/AbstractNode.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
Log:
Maintaining our own bit encoding is more efficient than an EnumSet
Modified: core/trunk/src/main/java/org/jboss/cache/AbstractNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/AbstractNode.java 2008-07-18 12:35:11 UTC (rev 6328)
+++ core/trunk/src/main/java/org/jboss/cache/AbstractNode.java 2008-07-18 12:36:52 UTC (rev 6329)
@@ -6,7 +6,6 @@
import static org.jboss.cache.AbstractNode.NodeFlags.DELETED;
import static org.jboss.cache.AbstractNode.NodeFlags.RESIDENT;
-import java.util.EnumSet;
import java.util.concurrent.ConcurrentMap;
/**
@@ -21,63 +20,117 @@
/**
* Flags placed on the node. Replaces older 'boolean' flags.
*/
- protected final EnumSet<NodeFlags> flags = EnumSet.noneOf(NodeFlags.class);
+ // NOTE: this is a lot more efficient than an EnumSet, expecially when initialising and copying.
+ protected short flags = 0;
/**
* These flags were originally stored as booleans on the UnversionedNode class. They have been replaced with an enum
* and an EnumSet, which is much more space-efficient for very little cost in lookups.
*/
- public enum NodeFlags
+ public static enum NodeFlags
{
/**
* All children are loaded from the cache loader if this flag is present.
*/
- CHILDREN_LOADED,
+ CHILDREN_LOADED(0x1),
/**
* Data is loaded from the cache loader if this flag is present.
*/
- DATA_LOADED,
+ DATA_LOADED(0x2),
/**
* Node is write-locked when children are added or removed if this flag is enabled.
*/
- LOCK_FOR_CHILD_INSERT_REMOVE,
+ LOCK_FOR_CHILD_INSERT_REMOVE(0x4),
/**
* Node is valid if this flag is present.
*/
- VALID,
+ VALID(0x8),
/**
* Node has been deleted.
*/
- DELETED,
+ DELETED(0x10),
/**
* NOde is resident and excluded from evictions
*/
- RESIDENT,
+ RESIDENT(0x20),
/**
* Specific to Optimistic Locking Workspace nodes - set if a node has been modified in a workspace.
*/
- MODIFIED_IN_WORKSPACE,
+ MODIFIED_IN_WORKSPACE(0x40),
/**
* Specific to Optimistic Locking Workspace nodes - set if a node has been created in a workspace.
*/
- CREATED_IN_WORKSPACE,
+ CREATED_IN_WORKSPACE(0x80),
/**
* Specific to Optimistic Locking Workspace nodes - set if a node has added or removed children in a workspace.
*/
- CHILDREN_MODIFIED_IN_WORKSPACE,
+ CHILDREN_MODIFIED_IN_WORKSPACE(0x100),
/**
* Specific to Optimistic Locking Workspace nodes - set if an implicit version is associated with this node.
*/
- VERSIONING_IMPLICIT,
+ VERSIONING_IMPLICIT(0x200),
/**
* Specific to Optimistic Locking Workspace nodes - set if a node has been resurrected in a workspace.
*/
- RESURRECTED_IN_WORKSPACE
+ RESURRECTED_IN_WORKSPACE(0x400);
+
+ protected final short mask;
+
+ NodeFlags(int mask)
+ {
+ this.mask = (short) mask;
+ }
}
+ /**
+ * Tests whether a flag is set.
+ *
+ * @param flag flag to test
+ * @return true if set, false otherwise.
+ */
+ protected final boolean isFlagSet(NodeFlags flag)
+ {
+ return (flags & flag.mask) != 0;
+ }
+
+ /**
+ * Utility method for setting or unsetting a flag. If status is true, the NodeFlag specified is added to the {@link #flags}
+ * encoded short. If status is false, the NodeFlag is removed from the encoded short.
+ *
+ * @param flag flag to set or unset
+ * @param value true to set the flag, false to unset the flag.
+ */
+ protected final void setFlag(NodeFlags flag, boolean value)
+ {
+ if (value)
+ setFlag(flag);
+ else
+ unsetFlag(flag);
+ }
+
+ /**
+ * Unility method that sets the value of the given flag to true.
+ *
+ * @param flag flag to set
+ */
+ protected final void setFlag(NodeFlags flag)
+ {
+ flags |= flag.mask;
+ }
+
+ /**
+ * Utility method that sets the value of the flag to false.
+ *
+ * @param flag flag to unset
+ */
+ protected final void unsetFlag(NodeFlags flag)
+ {
+ flags ^= flag.mask;
+ }
+
public boolean isDeleted()
{
- return flags.contains(DELETED);
+ return isFlagSet(DELETED);
}
public void markAsDeleted(boolean marker)
@@ -109,7 +162,7 @@
public boolean isResident()
{
- return flags.contains(RESIDENT);
+ return isFlagSet(RESIDENT);
}
@Override
@@ -128,19 +181,4 @@
{
return fqn.hashCode();
}
-
- /**
- * Utility method for setting or unsetting a flag. If status is true, the NodeFlag specified is added to the {@link #flags}
- * EnumSet. If status is false, the NodeFlag is removed from the EnumSet.
- *
- * @param flag flag to set or unset
- * @param status true to set the flag, false to unset the flag.
- */
- protected void setFlag(NodeFlags flag, boolean status)
- {
- if (status)
- flags.add(flag);
- else
- flags.remove(flag);
- }
}
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-18 12:35:11 UTC (rev 6328)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-18 12:36:52 UTC (rev 6329)
@@ -117,8 +117,8 @@
*/
protected void initFlags()
{
- flags.add(DATA_LOADED);
- flags.add(VALID);
+ setFlag(DATA_LOADED);
+ setFlag(VALID);
}
public NodeSPI<K, V> getDelegate()
@@ -183,7 +183,7 @@
public boolean isChildrenLoaded()
{
- return flags.contains(CHILDREN_LOADED);
+ return isFlagSet(CHILDREN_LOADED);
}
public void setChildrenLoaded(boolean childrenLoaded)
@@ -669,7 +669,7 @@
*/
public boolean isDataLoaded()
{
- return flags.contains(DATA_LOADED);
+ return isFlagSet(DATA_LOADED);
}
/**
@@ -682,7 +682,7 @@
public boolean isValid()
{
- return flags.contains(VALID);
+ return isFlagSet(VALID);
}
public void setValid(boolean valid, boolean recursive)
@@ -701,7 +701,7 @@
public boolean isLockForChildInsertRemove()
{
- return flags.contains(LOCK_FOR_CHILD_INSERT_REMOVE);
+ return isFlagSet(LOCK_FOR_CHILD_INSERT_REMOVE);
}
public void setLockForChildInsertRemove(boolean lockForChildInsertRemove)
@@ -723,8 +723,7 @@
n.commandsFactory = commandsFactory;
n.delegate = delegate;
n.nodeFactory = nodeFactory;
- n.flags.clear();
- n.flags.addAll(flags);
+ n.flags = flags;
n.lockStrategyFactory = lockStrategyFactory;
}
Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-07-18 12:35:11 UTC (rev 6328)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-07-18 12:36:52 UTC (rev 6329)
@@ -74,7 +74,7 @@
protected void initFlags()
{
- flags.add(VERSIONING_IMPLICIT);
+ setFlag(VERSIONING_IMPLICIT);
}
protected Set<Fqn> getChildrenAddedSet()
@@ -91,7 +91,7 @@
public boolean isChildrenModified()
{
- return flags.contains(CHILDREN_MODIFIED_IN_WORKSPACE);
+ return isFlagSet(CHILDREN_MODIFIED_IN_WORKSPACE);
}
public boolean isChildrenLoaded()
@@ -101,7 +101,7 @@
public boolean isResurrected()
{
- return flags.contains(RESURRECTED_IN_WORKSPACE);
+ return isFlagSet(RESURRECTED_IN_WORKSPACE);
}
public void markAsResurrected(boolean resurrected)
@@ -125,7 +125,7 @@
*/
public boolean isModified()
{
- return flags.contains(MODIFIED_IN_WORKSPACE);
+ return isFlagSet(MODIFIED_IN_WORKSPACE);
}
/**
@@ -146,7 +146,7 @@
public void putAll(Map<K, V> data)
{
realPut(data, false);
- setFlag(MODIFIED_IN_WORKSPACE, true);
+ setFlag(MODIFIED_IN_WORKSPACE);
}
public void replaceAll(Map<K, V> data)
@@ -157,7 +157,7 @@
public V put(K key, V value)
{
- setFlag(MODIFIED_IN_WORKSPACE, true);
+ setFlag(MODIFIED_IN_WORKSPACE);
if (optimisticDataMap == null) optimisticDataMap = new HashMap<K, V>();
return optimisticDataMap.put(key, value);
@@ -165,7 +165,7 @@
public V remove(K key)
{
- setFlag(MODIFIED_IN_WORKSPACE, true);
+ setFlag(MODIFIED_IN_WORKSPACE);
if (optimisticDataMap == null) return null;
return optimisticDataMap.remove(key);
@@ -213,7 +213,7 @@
private void realPut(Map<K, V> data, boolean eraseData, boolean forceDirtyFlag)
{
- if (forceDirtyFlag) setFlag(MODIFIED_IN_WORKSPACE, true);
+ if (forceDirtyFlag) setFlag(MODIFIED_IN_WORKSPACE);
if (eraseData && optimisticDataMap != null)
{
optimisticDataMap.clear();
@@ -241,13 +241,13 @@
NodeSPI<K, V> child = nodeFactory.createNode(childName, Fqn.fromRelativeElements(parent.getFqn(), childName), parent, null, true);
getChildrenAddedSet().add(child.getFqn());
if (childrenRemoved != null) childrenRemoved.remove(child.getFqn());
- setFlag(CHILDREN_MODIFIED_IN_WORKSPACE, true);
+ setFlag(CHILDREN_MODIFIED_IN_WORKSPACE);
return child;
}
public boolean isVersioningImplicit()
{
- return flags.contains(VERSIONING_IMPLICIT);
+ return isFlagSet(VERSIONING_IMPLICIT);
}
public void setVersioningImplicit(boolean versioningImplicit)
@@ -308,12 +308,12 @@
public boolean isCreated()
{
- return flags.contains(CREATED_IN_WORKSPACE);
+ return isFlagSet(CREATED_IN_WORKSPACE);
}
public void markAsCreated()
{
- setFlag(CREATED_IN_WORKSPACE, true);
+ setFlag(CREATED_IN_WORKSPACE);
// created != modified!!!
}
@@ -388,7 +388,7 @@
if (optimisticDataMap != null)
{
optimisticDataMap.clear();
- setFlag(MODIFIED_IN_WORKSPACE, true);
+ setFlag(MODIFIED_IN_WORKSPACE);
}
}
@@ -476,7 +476,7 @@
{*/
getChildrenRemovedSet().add(childFqn);
if (childrenAdded != null) childrenAdded.remove(childFqn);
- setFlag(CHILDREN_MODIFIED_IN_WORKSPACE, true);
+ setFlag(CHILDREN_MODIFIED_IN_WORKSPACE);
return node.getChildDirect(childName) != null;
/*}
else
17 years, 5 months
JBoss Cache SVN: r6328 - in core/branches/2.2.X/src/main/java/org/jboss/cache: optimistic and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-18 08:35:11 -0400 (Fri, 18 Jul 2008)
New Revision: 6328
Modified:
core/branches/2.2.X/src/main/java/org/jboss/cache/AbstractNode.java
core/branches/2.2.X/src/main/java/org/jboss/cache/UnversionedNode.java
core/branches/2.2.X/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
Log:
Maintaining our own bit encoding is more efficient than an EnumSet
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/AbstractNode.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/AbstractNode.java 2008-07-18 10:27:10 UTC (rev 6327)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/AbstractNode.java 2008-07-18 12:35:11 UTC (rev 6328)
@@ -6,7 +6,6 @@
import static org.jboss.cache.AbstractNode.NodeFlags.DELETED;
import static org.jboss.cache.AbstractNode.NodeFlags.RESIDENT;
-import java.util.EnumSet;
import java.util.Map;
/**
@@ -21,63 +20,117 @@
/**
* Flags placed on the node. Replaces older 'boolean' flags.
*/
- protected final EnumSet<NodeFlags> flags = EnumSet.noneOf(NodeFlags.class);
+ // NOTE: this is a lot more efficient than an EnumSet, expecially when initialising and copying.
+ protected short flags = 0;
/**
* These flags were originally stored as booleans on the UnversionedNode class. They have been replaced with an enum
* and an EnumSet, which is much more space-efficient for very little cost in lookups.
*/
- public enum NodeFlags
+ public static enum NodeFlags
{
/**
* All children are loaded from the cache loader if this flag is present.
*/
- CHILDREN_LOADED,
+ CHILDREN_LOADED(0x1),
/**
* Data is loaded from the cache loader if this flag is present.
*/
- DATA_LOADED,
+ DATA_LOADED(0x2),
/**
* Node is write-locked when children are added or removed if this flag is enabled.
*/
- LOCK_FOR_CHILD_INSERT_REMOVE,
+ LOCK_FOR_CHILD_INSERT_REMOVE(0x4),
/**
* Node is valid if this flag is present.
*/
- VALID,
+ VALID(0x8),
/**
* Node has been deleted.
*/
- DELETED,
+ DELETED(0x10),
/**
* NOde is resident and excluded from evictions
*/
- RESIDENT,
+ RESIDENT(0x20),
/**
* Specific to Optimistic Locking Workspace nodes - set if a node has been modified in a workspace.
*/
- MODIFIED_IN_WORKSPACE,
+ MODIFIED_IN_WORKSPACE(0x40),
/**
* Specific to Optimistic Locking Workspace nodes - set if a node has been created in a workspace.
*/
- CREATED_IN_WORKSPACE,
+ CREATED_IN_WORKSPACE(0x80),
/**
* Specific to Optimistic Locking Workspace nodes - set if a node has added or removed children in a workspace.
*/
- CHILDREN_MODIFIED_IN_WORKSPACE,
+ CHILDREN_MODIFIED_IN_WORKSPACE(0x100),
/**
* Specific to Optimistic Locking Workspace nodes - set if an implicit version is associated with this node.
*/
- VERSIONING_IMPLICIT,
+ VERSIONING_IMPLICIT(0x200),
/**
* Specific to Optimistic Locking Workspace nodes - set if a node has been resurrected in a workspace.
*/
- RESURRECTED_IN_WORKSPACE
+ RESURRECTED_IN_WORKSPACE(0x400);
+
+ protected final short mask;
+
+ NodeFlags(int mask)
+ {
+ this.mask = (short) mask;
+ }
}
+ /**
+ * Tests whether a flag is set.
+ *
+ * @param flag flag to test
+ * @return true if set, false otherwise.
+ */
+ protected final boolean isFlagSet(NodeFlags flag)
+ {
+ return (flags & flag.mask) != 0;
+ }
+
+ /**
+ * Utility method for setting or unsetting a flag. If status is true, the NodeFlag specified is added to the {@link #flags}
+ * encoded short. If status is false, the NodeFlag is removed from the encoded short.
+ *
+ * @param flag flag to set or unset
+ * @param value true to set the flag, false to unset the flag.
+ */
+ protected final void setFlag(NodeFlags flag, boolean value)
+ {
+ if (value)
+ setFlag(flag);
+ else
+ unsetFlag(flag);
+ }
+
+ /**
+ * Unility method that sets the value of the given flag to true.
+ *
+ * @param flag flag to set
+ */
+ protected final void setFlag(NodeFlags flag)
+ {
+ flags |= flag.mask;
+ }
+
+ /**
+ * Utility method that sets the value of the flag to false.
+ *
+ * @param flag flag to unset
+ */
+ protected final void unsetFlag(NodeFlags flag)
+ {
+ flags ^= flag.mask;
+ }
+
public boolean isDeleted()
{
- return flags.contains(DELETED);
+ return isFlagSet(DELETED);
}
public void markAsDeleted(boolean marker)
@@ -109,7 +162,7 @@
public boolean isResident()
{
- return flags.contains(RESIDENT);
+ return isFlagSet(RESIDENT);
}
@Override
@@ -128,19 +181,4 @@
{
return fqn.hashCode();
}
-
- /**
- * Utility method for setting or unsetting a flag. If status is true, the NodeFlag specified is added to the {@link #flags}
- * EnumSet. If status is false, the NodeFlag is removed from the EnumSet.
- *
- * @param flag flag to set or unset
- * @param status true to set the flag, false to unset the flag.
- */
- protected void setFlag(NodeFlags flag, boolean status)
- {
- if (status)
- flags.add(flag);
- else
- flags.remove(flag);
- }
}
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-18 10:27:10 UTC (rev 6327)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-18 12:35:11 UTC (rev 6328)
@@ -101,8 +101,8 @@
*/
protected void initFlags()
{
- flags.add(DATA_LOADED);
- flags.add(VALID);
+ setFlag(DATA_LOADED);
+ setFlag(VALID);
}
public NodeSPI getDelegate()
@@ -176,7 +176,7 @@
public boolean isChildrenLoaded()
{
- return flags.contains(CHILDREN_LOADED);
+ return isFlagSet(CHILDREN_LOADED);
}
public void setChildrenLoaded(boolean childrenLoaded)
@@ -685,7 +685,7 @@
*/
public boolean isDataLoaded()
{
- return flags.contains(DATA_LOADED);
+ return isFlagSet(DATA_LOADED);
}
/**
@@ -698,7 +698,7 @@
public boolean isValid()
{
- return flags.contains(VALID);
+ return isFlagSet(VALID);
}
public void setValid(boolean valid, boolean recursive)
@@ -717,7 +717,7 @@
public boolean isLockForChildInsertRemove()
{
- return flags.contains(LOCK_FOR_CHILD_INSERT_REMOVE);
+ return isFlagSet(LOCK_FOR_CHILD_INSERT_REMOVE);
}
public void setLockForChildInsertRemove(boolean lockForChildInsertRemove)
Modified: core/branches/2.2.X/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java
===================================================================
--- core/branches/2.2.X/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-07-18 10:27:10 UTC (rev 6327)
+++ core/branches/2.2.X/src/main/java/org/jboss/cache/optimistic/WorkspaceNodeImpl.java 2008-07-18 12:35:11 UTC (rev 6328)
@@ -72,7 +72,7 @@
protected void initFlags()
{
- flags.add(VERSIONING_IMPLICIT);
+ setFlag(VERSIONING_IMPLICIT);
}
protected Set<Fqn> getChildrenAddedSet()
@@ -89,7 +89,7 @@
public boolean isChildrenModified()
{
- return flags.contains(CHILDREN_MODIFIED_IN_WORKSPACE);
+ return isFlagSet(CHILDREN_MODIFIED_IN_WORKSPACE);
}
public boolean isChildrenLoaded()
@@ -99,7 +99,7 @@
public boolean isResurrected()
{
- return flags.contains(RESURRECTED_IN_WORKSPACE);
+ return isFlagSet(RESURRECTED_IN_WORKSPACE);
}
public void markAsResurrected(boolean resurrected)
@@ -123,7 +123,7 @@
*/
public boolean isModified()
{
- return flags.contains(MODIFIED_IN_WORKSPACE);
+ return isFlagSet(MODIFIED_IN_WORKSPACE);
}
/**
@@ -144,7 +144,7 @@
public void putAll(Map<K, V> data)
{
realPut(data, false);
- setFlag(MODIFIED_IN_WORKSPACE, true);
+ setFlag(MODIFIED_IN_WORKSPACE);
}
public void replaceAll(Map<K, V> data)
@@ -155,7 +155,7 @@
public V put(K key, V value)
{
- setFlag(MODIFIED_IN_WORKSPACE, true);
+ setFlag(MODIFIED_IN_WORKSPACE);
if (optimisticDataMap == null) optimisticDataMap = new HashMap<K, V>();
return optimisticDataMap.put(key, value);
@@ -163,7 +163,7 @@
public V remove(K key)
{
- setFlag(MODIFIED_IN_WORKSPACE, true);
+ setFlag(MODIFIED_IN_WORKSPACE);
if (optimisticDataMap == null) return null;
return optimisticDataMap.remove(key);
@@ -211,7 +211,7 @@
private void realPut(Map<K, V> data, boolean eraseData, boolean forceDirtyFlag)
{
- if (forceDirtyFlag) setFlag(MODIFIED_IN_WORKSPACE, true);
+ if (forceDirtyFlag) setFlag(MODIFIED_IN_WORKSPACE);
if (eraseData && optimisticDataMap != null)
{
optimisticDataMap.clear();
@@ -240,13 +240,13 @@
NodeSPI<K, V> child = (NodeSPI<K, V>) factory.createNodeOfType(parent, child_name, parent, null);
getChildrenAddedSet().add(child.getFqn());
if (childrenRemoved != null) childrenRemoved.remove(child.getFqn());
- setFlag(CHILDREN_MODIFIED_IN_WORKSPACE, true);
+ setFlag(CHILDREN_MODIFIED_IN_WORKSPACE);
return child;
}
public boolean isVersioningImplicit()
{
- return flags.contains(VERSIONING_IMPLICIT);
+ return isFlagSet(VERSIONING_IMPLICIT);
}
public void setVersioningImplicit(boolean versioningImplicit)
@@ -307,12 +307,12 @@
public boolean isCreated()
{
- return flags.contains(CREATED_IN_WORKSPACE);
+ return isFlagSet(CREATED_IN_WORKSPACE);
}
public void markAsCreated()
{
- setFlag(CREATED_IN_WORKSPACE, true);
+ setFlag(CREATED_IN_WORKSPACE);
// created != modified!!!
}
@@ -387,7 +387,7 @@
if (optimisticDataMap != null)
{
optimisticDataMap.clear();
- setFlag(MODIFIED_IN_WORKSPACE, true);
+ setFlag(MODIFIED_IN_WORKSPACE);
}
}
@@ -475,7 +475,7 @@
{*/
getChildrenRemovedSet().add(childFqn);
if (childrenAdded != null) childrenAdded.remove(childFqn);
- setFlag(CHILDREN_MODIFIED_IN_WORKSPACE, true);
+ setFlag(CHILDREN_MODIFIED_IN_WORKSPACE);
return node.getChildDirect(childName) != null;
/*}
else
17 years, 5 months
JBoss Cache SVN: r6327 - in benchmarks/benchmark-fwk/trunk/cache-products: jbosscache-2.2.0/conf and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-18 06:27:10 -0400 (Fri, 18 Jul 2008)
New Revision: 6327
Added:
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.1.0/conf/pess-local-NONE.xml
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.2.0/conf/pess-local-NONE.xml
Log:
Added more confs
Added: benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.1.0/conf/pess-local-NONE.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.1.0/conf/pess-local-NONE.xml (rev 0)
+++ benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.1.0/conf/pess-local-NONE.xml 2008-07-18 10:27:10 UTC (rev 6327)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample for total replication. -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
+
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=testTreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ Configure the TransactionManager
+ -->
+ <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">NONE</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ INVALIDATION_ASYNC
+ INVALIDATION_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+ cluster in order to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">15000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">10000</attribute>
+ </mbean>
+</server>
Added: benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.2.0/conf/pess-local-NONE.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.2.0/conf/pess-local-NONE.xml (rev 0)
+++ benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.2.0/conf/pess-local-NONE.xml 2008-07-18 10:27:10 UTC (rev 6327)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample for total replication. -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
+
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=testTreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ Configure the TransactionManager
+ -->
+ <attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
+ </attribute>
+
+
+ <!--
+ Node locking level : SERIALIZABLE
+ REPEATABLE_READ (default)
+ READ_COMMITTED
+ READ_UNCOMMITTED
+ NONE
+ -->
+ <attribute name="IsolationLevel">NONE</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ INVALIDATION_ASYNC
+ INVALIDATION_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
+ cluster in order to find each other.
+ -->
+ <attribute name="ClusterName">JBossCache-Cluster</attribute>
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">15000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">10000</attribute>
+ </mbean>
+</server>
17 years, 5 months
JBoss Cache SVN: r6326 - benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.2.0/lib.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-18 06:22:39 -0400 (Fri, 18 Jul 2008)
New Revision: 6326
Modified:
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.2.0/lib/jbosscache-core.jar
Log:
UPdated to 2.2.0.CR6
Modified: benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-2.2.0/lib/jbosscache-core.jar
===================================================================
(Binary files differ)
17 years, 5 months
JBoss Cache SVN: r6325 - in core/trunk/src/main/java/org/jboss/cache: optimistic and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-18 06:19:40 -0400 (Fri, 18 Jul 2008)
New Revision: 6325
Modified:
core/trunk/src/main/java/org/jboss/cache/config/Option.java
core/trunk/src/main/java/org/jboss/cache/optimistic/DataVersion.java
core/trunk/src/main/java/org/jboss/cache/optimistic/DefaultDataVersion.java
Log:
Deprecation
Modified: core/trunk/src/main/java/org/jboss/cache/config/Option.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/Option.java 2008-07-18 05:01:19 UTC (rev 6324)
+++ core/trunk/src/main/java/org/jboss/cache/config/Option.java 2008-07-18 10:19:40 UTC (rev 6325)
@@ -94,7 +94,10 @@
/**
* @since 1.3.0
+ * @deprecated this is to support a deprecated locking scheme (Optimistic Locking). Will be removed when Optimistic Locking support is removed.
*/
+ @Deprecated
+ @SuppressWarnings("deprecation")
public DataVersion getDataVersion()
{
return dataVersion;
@@ -104,7 +107,10 @@
* Passing in an {@link org.jboss.cache.optimistic.DataVersion} instance when using optimistic locking will override the default behaviour of internally generated version info and allow the caller to handle data versioning.
*
* @since 1.3.0
+ * @deprecated this is to support a deprecated locking scheme (Optimistic Locking). Will be removed when Optimistic Locking support is removed.
*/
+ @Deprecated
+ @SuppressWarnings("deprecation")
public void setDataVersion(DataVersion dataVersion)
{
this.dataVersion = dataVersion;
Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/DataVersion.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/DataVersion.java 2008-07-18 05:01:19 UTC (rev 6324)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/DataVersion.java 2008-07-18 10:19:40 UTC (rev 6325)
@@ -18,7 +18,9 @@
* frequently serialized to be replicated across the wire.
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
+ * @deprecated this is to support a deprecated locking scheme (Optimistic Locking). Will be removed when Optimistic Locking support is removed.
*/
+@Deprecated
public interface DataVersion extends Serializable
{
/**
Modified: core/trunk/src/main/java/org/jboss/cache/optimistic/DefaultDataVersion.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/optimistic/DefaultDataVersion.java 2008-07-18 05:01:19 UTC (rev 6324)
+++ core/trunk/src/main/java/org/jboss/cache/optimistic/DefaultDataVersion.java 2008-07-18 10:19:40 UTC (rev 6325)
@@ -18,8 +18,10 @@
* break things.
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
+ * @deprecated this is to support a deprecated locking scheme (Optimistic Locking). Will be removed when Optimistic Locking support is removed.
*/
@Immutable
+@Deprecated
public class DefaultDataVersion implements DataVersion
{
private static final long serialVersionUID = -6896315742831861046L;
17 years, 5 months
JBoss Cache SVN: r6323 - in pojo/trunk: src/test/java/org/jboss/cache/pojo/notification and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2008-07-18 00:18:10 -0400 (Fri, 18 Jul 2008)
New Revision: 6323
Modified:
pojo/trunk/pom.xml
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/Listener.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ObjectTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedListTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedMapTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedObjectTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedSetTest.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/SetTest.java
Log:
Update to CR6
Fix state transfer race in notification tests
Modified: pojo/trunk/pom.xml
===================================================================
--- pojo/trunk/pom.xml 2008-07-17 16:08:09 UTC (rev 6322)
+++ pojo/trunk/pom.xml 2008-07-18 04:18:10 UTC (rev 6323)
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<properties>
<jbosscache-pojo-version>2.2.0-SNAPSHOT</jbosscache-pojo-version>
- <jbosscache-core-version>2.2.0.CR5</jbosscache-core-version>
+ <jbosscache-core-version>2.2.0.CR6</jbosscache-core-version>
<jboss.aop.version>2.0.0.CR14</jboss.aop.version>
</properties>
<parent>
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java 2008-07-17 16:08:09 UTC (rev 6322)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ListTest.java 2008-07-18 04:18:10 UTC (rev 6323)
@@ -118,7 +118,7 @@
// List Attach
attach = takeNotification(AttachedEvent.class);
assertEquals(list, attach.getSource());
-
+ //cache.detach("a");
}
@SuppressWarnings("unchecked")
@@ -129,8 +129,8 @@
List<String> list = new ArrayList<String>();
list.add(test1);
- cache.attach("a", list);
- list = (List<String>) cache.find("a");
+ cache.attach("b", list);
+ list = (List<String>) cache.find("b");
list.set(0, test2);
// String attach
@@ -160,6 +160,7 @@
assertEquals(ListModifiedEvent.Operation.SET, modify.getOperation());
assertEquals(test2, modify.getValue());
assertEquals(0, modify.getIndex());
+ //cache.detach("b");
}
@SuppressWarnings("unchecked")
@@ -171,8 +172,8 @@
List<String> list = new ArrayList<String>();
list.add(test1);
list.add(test2);
- cache.attach("a", list);
- list = (List<String>) cache.find("a");
+ cache.attach("c", list);
+ list = (List<String>) cache.find("c");
list.remove(1);
// String attach
@@ -208,6 +209,7 @@
// String detach
DetachedEvent detach = takeNotification(DetachedEvent.class);
assertEquals(test2, detach.getSource());
+ //cache.detach("c");
}
public void testObjectListAdd() throws Exception
@@ -225,7 +227,7 @@
list.add(taiwanese);
test.setLanguages(list);
- cache.attach("a", test);
+ cache.attach("d", test);
// String attach
AttachedEvent attach = takeNotification(AttachedEvent.class);
@@ -254,6 +256,8 @@
// Person Attach
attach = takeNotification(AttachedEvent.class);
assertEquals(test, attach.getSource());
+
+ //cache.detach("d");
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/Listener.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/Listener.java 2008-07-17 16:08:09 UTC (rev 6322)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/Listener.java 2008-07-18 04:18:10 UTC (rev 6323)
@@ -22,11 +22,9 @@
package org.jboss.cache.pojo.notification;
-import java.util.LinkedList;
-import java.util.Queue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
-import net.jcip.annotations.NotThreadSafe;
-
import org.jboss.cache.pojo.notification.annotation.Attached;
import org.jboss.cache.pojo.notification.annotation.Detached;
import org.jboss.cache.pojo.notification.annotation.FieldModified;
@@ -39,20 +37,27 @@
// $Id$
/**
- * A recoding Listener for notification test package. This is not thread safe, just for testing.
+ * A recoding Listener for notification test package.
*
* @author Jason T. Greene
*/
@PojoCacheListener
-@NotThreadSafe
public class Listener
{
- private Queue<Event> events = new LinkedList<Event>();
+ private BlockingQueue<Event> events = new LinkedBlockingQueue<Event>();
@SuppressWarnings("unchecked")
public <T extends Event> T take(Class<T> t)
{
- Event notification = events.remove();
+ Event notification;
+ try
+ {
+ notification = events.take();
+ }
+ catch (InterruptedException e)
+ {
+ throw new RuntimeException(e);
+ }
if (!t.isInstance(notification))
throw new IllegalStateException("Expected notification type: " + t.getSimpleName() + " but was: " + notification.getClass().getSimpleName());
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java 2008-07-17 16:08:09 UTC (rev 6322)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/MapTest.java 2008-07-18 04:18:10 UTC (rev 6323)
@@ -51,7 +51,6 @@
protected PojoCache cache;
protected Listener listener = new Listener();
-
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
@@ -122,6 +121,8 @@
attach = takeNotification(AttachedEvent.class);
assertEquals(map, attach.getSource());
+ //cache.detach("a");
+
}
@SuppressWarnings("unchecked")
@@ -135,8 +136,8 @@
Map<String, String> map = new LinkedHashMap<String, String>();
map.put(key1, test1);
map.put(key2, test2);
- cache.attach("a", map);
- map = (Map<String, String>) cache.find("a");
+ cache.attach("b", map);
+ map = (Map<String, String>) cache.find("b");
map.remove(key2);
// String attach
@@ -172,6 +173,8 @@
// String detach
DetachedEvent detach = takeNotification(DetachedEvent.class);
assertEquals(test2, detach.getSource());
+
+ //cache.detach("b");
}
public void testObjectMapAdd() throws Exception
@@ -189,7 +192,7 @@
map.put(key1, drumming);
map.put(key2, engineering);
test.setHobbies(map);
- cache.attach("a", test);
+ cache.attach("c", test);
// String attach
AttachedEvent attach = takeNotification(AttachedEvent.class);
@@ -218,6 +221,8 @@
// Person Attach
attach = takeNotification(AttachedEvent.class);
assertEquals(test, attach.getSource());
+
+ //cache.detach("c");
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ObjectTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ObjectTest.java 2008-07-17 16:08:09 UTC (rev 6322)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ObjectTest.java 2008-07-18 04:18:10 UTC (rev 6323)
@@ -34,7 +34,7 @@
public class ObjectTest
{
protected PojoCache cache;
- protected Listener listener;
+ protected Listener listener = new Listener();
@BeforeMethod(alwaysRun = true)
@@ -45,7 +45,6 @@
cache = PojoCacheFactory.createCache(configFile, toStart);
cache.start();
- listener = new Listener();
cache.addListener(listener);
}
@@ -69,6 +68,7 @@
protected void tearDown() throws Exception
{
cache.stop();
+ listener.clear();
}
public void testAttachNotification() throws Exception
@@ -79,6 +79,7 @@
cache.attach("/a", test);
AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(test, attach.getSource());
+ //cache.detach("/a");
}
public void testAttachNotification2() throws Exception
@@ -88,7 +89,7 @@
test.setAge(10);
Address addr = new Address();
test.setAddress(addr);
- cache.attach("/a", test);
+ cache.attach("/b", test);
// Address Attach
AttachedEvent attach = takeNotification(AttachedEvent.class);
@@ -97,6 +98,7 @@
// Person Attach
attach = takeNotification(AttachedEvent.class);
assertEquals(test, attach.getSource());
+ //cache.detach("/b");
}
public void testDetachNotification() throws Exception
@@ -104,14 +106,14 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- cache.attach("/a", test);
+ cache.attach("/c", test);
// Person Attach
AttachedEvent attach = takeNotification(AttachedEvent.class);
Object attached = attach.getSource();
assertEquals(test, attached);
- cache.detach("/a");
+ cache.detach("/c");
// Person Detach
DetachedEvent detach = takeNotification(DetachedEvent.class);
@@ -123,7 +125,7 @@
Person test = new Person();
test.setName("Ben");
test.setAge(10);
- cache.attach("/a", test);
+ cache.attach("/d", test);
// Person Attach
AttachedEvent attach = takeNotification(AttachedEvent.class);
@@ -152,5 +154,7 @@
assertEquals(test, modify.getSource());
assertEquals(test.getClass().getDeclaredField("address"), modify.getField());
assertEquals(addr, modify.getValue());
+
+ //cache.detach("/d");
}
}
\ No newline at end of file
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedListTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedListTest.java 2008-07-17 16:08:09 UTC (rev 6322)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedListTest.java 2008-07-18 04:18:10 UTC (rev 6323)
@@ -25,6 +25,7 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertSame;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.pojo.PojoCache;
@@ -49,9 +50,13 @@
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
- cache = PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
+ config.setFetchInMemoryState(false);
+ Configuration config2 = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
+ config2.setFetchInMemoryState(false);
+ cache = PojoCacheFactory.createCache(config, false);
cache.start();
- listenerCache = PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ listenerCache = PojoCacheFactory.createCache(config2, false);
listenerCache.start();
listenerCache.addListener(listener);
}
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedMapTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedMapTest.java 2008-07-17 16:08:09 UTC (rev 6322)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedMapTest.java 2008-07-18 04:18:10 UTC (rev 6323)
@@ -25,6 +25,7 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertSame;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.pojo.PojoCache;
@@ -49,11 +50,13 @@
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
- super.setUp();
-
- cache = PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
+ config.setFetchInMemoryState(false);
+ Configuration config2 = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
+ config2.setFetchInMemoryState(false);
+ cache = PojoCacheFactory.createCache(config, false);
cache.start();
- listenerCache = PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ listenerCache = PojoCacheFactory.createCache(config2, false);
listenerCache.start();
listenerCache.addListener(listener);
}
@@ -61,9 +64,9 @@
@AfterMethod(alwaysRun = true)
protected void tearDown() throws Exception
{
- super.tearDown();
cache.stop();
listenerCache.stop();
+ listener.clear();
}
protected void verifyNotification(Event notification)
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedObjectTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedObjectTest.java 2008-07-17 16:08:09 UTC (rev 6322)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedObjectTest.java 2008-07-18 04:18:10 UTC (rev 6323)
@@ -25,6 +25,7 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertSame;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.pojo.PojoCache;
@@ -49,11 +50,14 @@
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
- cache = PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
+ config.setFetchInMemoryState(false);
+ Configuration config2 = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
+ config2.setFetchInMemoryState(false);
+ cache = PojoCacheFactory.createCache(config, false);
cache.start();
- listenerCache = PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ listenerCache = PojoCacheFactory.createCache(config2, false);
listenerCache.start();
- listener = new Listener();
listenerCache.addListener(listener);
}
@AfterMethod(alwaysRun = true)
@@ -61,6 +65,7 @@
{
cache.stop();
listenerCache.stop();
+ listener.clear();
}
protected void verifyNotification(Event notification)
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedSetTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedSetTest.java 2008-07-17 16:08:09 UTC (rev 6322)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/ReplicatedSetTest.java 2008-07-18 04:18:10 UTC (rev 6323)
@@ -25,6 +25,7 @@
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertSame;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.pojo.PojoCache;
@@ -42,18 +43,20 @@
* @author Jason T. Greene
*/
@Test(groups = {"functional"})
-public class ReplicatedSetTest extends ListTest
+public class ReplicatedSetTest extends SetTest
{
private PojoCache listenerCache;
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception
{
- super.setUp();
-
- cache = PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
+ config.setFetchInMemoryState(false);
+ Configuration config2 = UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC);
+ config2.setFetchInMemoryState(false);
+ cache = PojoCacheFactory.createCache(config, false);
cache.start();
- listenerCache = PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), false);
+ listenerCache = PojoCacheFactory.createCache(config2, false);
listenerCache.start();
listenerCache.addListener(listener);
}
@@ -61,9 +64,9 @@
@AfterMethod(alwaysRun = true)
protected void tearDown() throws Exception
{
- super.tearDown();
cache.stop();
listenerCache.stop();
+ listener.clear();
}
protected void verifyNotification(Event notification)
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/SetTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/SetTest.java 2008-07-17 16:08:09 UTC (rev 6322)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/notification/SetTest.java 2008-07-18 04:18:10 UTC (rev 6323)
@@ -46,10 +46,10 @@
* @author Jason T. Greene
*/
@Test(groups = {"functional"})
-public class SetTest
+public class SetTest
{
- private PojoCache cache;
- private Listener listener = new Listener();
+ protected PojoCache cache;
+ protected Listener listener = new Listener();
@BeforeMethod(alwaysRun = true)
@@ -66,6 +66,7 @@
protected void tearDown() throws Exception
{
cache.stop();
+ listener.clear();
}
private <T extends Event> T takeNotification(Class<T> clazz)
@@ -114,8 +115,9 @@
// Set Attach
attach = takeNotification(AttachedEvent.class);
- assertSame(set, attach.getSource());
+ assertEquals(set, attach.getSource());
+ //cache.detach("a");
}
@SuppressWarnings("unchecked")
@@ -127,9 +129,9 @@
Set<String> set = new LinkedHashSet<String>();
set.add(test1);
set.add(test2);
- cache.attach("a", set);
+ cache.attach("b", set);
- set = (Set<String>) cache.find("a");
+ set = (Set<String>) cache.find("b");
set.remove(test2);
// String attach
@@ -152,7 +154,7 @@
// Set Attach
attach = takeNotification(AttachedEvent.class);
- assertSame(set, attach.getSource());
+ assertEquals(set, attach.getSource());
// Set remove
modify = takeNotification(SetModifiedEvent.class);
@@ -162,6 +164,8 @@
// String detach
DetachedEvent detach = takeNotification(DetachedEvent.class);
assertEquals(test2, detach.getSource());
+
+ //cache.detach("b");
}
public void testObjectSetAdd() throws Exception
@@ -177,7 +181,7 @@
set.add(drumming);
set.add(engineering);
test.setSkills(set);
- cache.attach("a", test);
+ cache.attach("c", test);
// String attach
AttachedEvent attach = takeNotification(AttachedEvent.class);
@@ -204,7 +208,7 @@
// Person Attach
attach = takeNotification(AttachedEvent.class);
assertEquals(test, attach.getSource());
+
+ //cache.detach("c");
}
-
-
}
17 years, 5 months