JBoss Cache SVN: r6378 - in core/trunk/src: main/java/org/jboss/cache/invocation and 5 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-23 11:00:08 -0400 (Wed, 23 Jul 2008)
New Revision: 6378
Added:
core/trunk/src/test/java/org/jboss/cache/util/ImmutableListCopyTest.java
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java
core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java
core/trunk/src/main/java/org/jboss/cache/invocation/InvocationContext.java
core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
core/trunk/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java
core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java
core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java
core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java
core/trunk/src/main/java/org/jboss/cache/util/ImmutableListCopy.java
Log:
Implemented efficient custom collections in place of immutable and defensively copied collections
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java 2008-07-23 14:23:32 UTC (rev 6377)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java 2008-07-23 15:00:08 UTC (rev 6378)
@@ -35,6 +35,7 @@
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
+import java.util.ListIterator;
import java.util.Map;
/**
@@ -321,18 +322,18 @@
if (!(locks = ctx.getLocks()).isEmpty())
{
// clean up.
- Fqn[] fqnsToUnlock = new Fqn[locks.size()];
- fqnsToUnlock = locks.toArray(fqnsToUnlock);
+ // unlocking needs to be done in reverse order.
+ ListIterator<Fqn> it = locks.listIterator(locks.size());
Object owner = Thread.currentThread();
-
- for (int i = fqnsToUnlock.length - 1; i > -1; i--)
+ while (it.hasPrevious())
{
+ Fqn f = it.previous();
// for each of these, swap refs
- ReadCommittedNode rcn = (ReadCommittedNode) ctx.lookUpNode(fqnsToUnlock[i]);
+ ReadCommittedNode rcn = (ReadCommittedNode) ctx.lookUpNode(f);
if (rcn != null) rcn.commitUpdate(ctx, dataContainer, nodeFactory); // could be null with read-committed
// and then unlock
- if (trace) log.trace("Releasing lock on [" + fqnsToUnlock[i] + "] for thread " + owner);
- lockManager.unlock(fqnsToUnlock[i], owner);
+ if (trace) log.trace("Releasing lock on [" + f + "] for thread " + owner);
+ lockManager.unlock(f, owner);
}
ctx.clearLocks();
}
@@ -356,13 +357,13 @@
if (!(locks = ctx.getTransactionContext().getLocks()).isEmpty())
{
// clean up.
- Fqn[] fqnsToUnlock = new Fqn[locks.size()];
- fqnsToUnlock = locks.toArray(fqnsToUnlock);
+ // unlocking needs to be done in reverse order.
+ ListIterator<Fqn> it = locks.listIterator(locks.size());
Object owner = ctx.getGlobalTransaction();
-
- for (int i = fqnsToUnlock.length - 1; i > -1; i--)
+ while (it.hasPrevious())
{
- ReadCommittedNode rcn = (ReadCommittedNode) ctx.lookUpNode(fqnsToUnlock[i]);
+ Fqn f = it.previous();
+ ReadCommittedNode rcn = (ReadCommittedNode) ctx.lookUpNode(f);
if (rcn != null) // could be null with read-committed
{
if (commit)
@@ -376,8 +377,8 @@
}
}
// and then unlock
- if (trace) log.trace("Releasing lock on [" + fqnsToUnlock[i] + "] for transaction " + owner);
- lockManager.unlock(fqnsToUnlock[i], owner);
+ if (trace) log.trace("Releasing lock on [" + f + "] for transaction " + owner);
+ lockManager.unlock(f, owner);
}
ctx.clearLocks();
}
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java 2008-07-23 14:23:32 UTC (rev 6377)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java 2008-07-23 15:00:08 UTC (rev 6378)
@@ -182,6 +182,19 @@
}
}
+ public boolean hasLock(Object lock)
+ {
+ // first check transactional scope
+ if (transactionContext != null)
+ {
+ return transactionContext.hasLock(lock);
+ }
+ else
+ {
+ return invocationLocks != null && invocationLocks.contains(lock);
+ }
+ }
+
public boolean isLockingSuppressed()
{
return getOptionOverrides() != null && getOptionOverrides().isSuppressLocking();
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/InvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/InvocationContext.java 2008-07-23 14:23:32 UTC (rev 6377)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/InvocationContext.java 2008-07-23 15:00:08 UTC (rev 6378)
@@ -205,7 +205,17 @@
*/
void clearLocks();
+
/**
+ * Note that if a transaction is in scope, implementations should test this lock from on {@link org.jboss.cache.transaction.TransactionContext}.
+ * Using this method should always ensure locks checked in the appropriate scope.
+ *
+ * @param lock lock to test
+ * @return true if the lock being tested is already held in the current scope, false otherwise.
+ */
+ boolean hasLock(Object lock);
+
+ /**
* @return true if options exist to suppress locking - false otherwise. Note that this is only used by the {@link org.jboss.cache.interceptors.PessimisticLockInterceptor}.
*/
boolean isLockingSuppressed();
Modified: core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java 2008-07-23 14:23:32 UTC (rev 6377)
+++ core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java 2008-07-23 15:00:08 UTC (rev 6378)
@@ -20,6 +20,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.ListIterator;
import java.util.Set;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import java.util.concurrent.locks.Lock;
@@ -123,12 +124,12 @@
if (!locks.isEmpty())
{
// unlocking needs to be done in reverse order.
- Fqn[] fqns = new Fqn[locks.size()];
- fqns = locks.toArray(fqns);
- for (int i = fqns.length - 1; i > -1; i--)
+ ListIterator<Fqn> it = locks.listIterator(locks.size());
+ while (it.hasPrevious())
{
- if (trace) log.trace("Attempting to unlock " + fqns[i]);
- lockContainer.getLock(fqns[i]).unlock();
+ Fqn f = it.previous();
+ if (trace) log.trace("Attempting to unlock " + f);
+ lockContainer.getLock(f).unlock();
}
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java 2008-07-23 14:23:32 UTC (rev 6377)
+++ core/trunk/src/main/java/org/jboss/cache/lock/NodeBasedLockManager.java 2008-07-23 15:00:08 UTC (rev 6378)
@@ -12,6 +12,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.ListIterator;
/**
* @author Mircea.Markus(a)jboss.com
@@ -119,14 +120,16 @@
if (locks.isEmpty()) return;
Object owner = getLockOwner(ctx);
- // Copying out to an array is faster than creating an ArrayList and iterating,
- // since list creation will just copy out to an array internally
- NodeLock[] lockArray = locks.toArray(new NodeLock[locks.size()]);
- for (int i = lockArray.length - 1; i >= 0; i--)
+
+ // unlocking needs to be done in reverse order.
+ ListIterator<NodeLock> it = locks.listIterator(locks.size());
+ while (it.hasPrevious())
{
+ NodeLock l = it.previous();
+
if (trace)
- log.trace("releasing lock for " + lockArray[i].getFqn() + " (" + lockArray[i] + "), owner " + owner);
- lockArray[i].release(owner);
+ log.trace("releasing lock for " + l.getFqn() + " (" + l + "), owner " + owner);
+ l.release(owner);
}
ctx.clearLocks();
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java 2008-07-23 14:23:32 UTC (rev 6377)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java 2008-07-23 15:00:08 UTC (rev 6378)
@@ -139,7 +139,7 @@
// lock which may be shared with another Fqn that we have a lock for already.
// nothing wrong, just means that we fail to record the lock. And that is a problem.
// Better to check our records and lock again if necessary.
- if (!ctx.getLocks().contains(fqn))
+ if (!ctx.hasLock(fqn))
{
if (!lockManager.lockAndRecord(fqn, WRITE, ctx))
{
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java 2008-07-23 14:23:32 UTC (rev 6377)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java 2008-07-23 15:00:08 UTC (rev 6378)
@@ -159,6 +159,10 @@
if (transactionLocks != null) transactionLocks.clear();
}
+ public boolean hasLock(Object lock)
+ {
+ return transactionLocks != null && transactionLocks.contains(lock);
+ }
@SuppressWarnings("unchecked")
public void addAllLocks(List newLocks)
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java 2008-07-23 14:23:32 UTC (rev 6377)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/TransactionContext.java 2008-07-23 15:00:08 UTC (rev 6378)
@@ -156,6 +156,15 @@
List getLocks();
/**
+ * Most code could not use this method directly, but use {@link org.jboss.cache.invocation.InvocationContext#hasLock(Object)} ()} instead,
+ * which would delegate to this method if a transaction is in scope or otherwise use invocation-specific locks.
+ *
+ * @param lock lock to test
+ * @return true if the lock being tested is already held in the current scope, false otherwise.
+ */
+ boolean hasLock(Object lock);
+
+ /**
* Gets the value of the forceAsyncReplication flag. Used by ReplicationInterceptor and OptimisticReplicationInterceptor
* when dealing with {@link org.jboss.cache.Cache#putForExternalRead(org.jboss.cache.Fqn,Object,Object)} within
* a transactional context.
Modified: core/trunk/src/main/java/org/jboss/cache/util/ImmutableListCopy.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/ImmutableListCopy.java 2008-07-23 14:23:32 UTC (rev 6377)
+++ core/trunk/src/main/java/org/jboss/cache/util/ImmutableListCopy.java 2008-07-23 15:00:08 UTC (rev 6378)
@@ -204,13 +204,12 @@
@Override
public final ListIterator<E> listIterator()
{
- return listIterator(0);
+ return new ImmutableIterator();
}
@Override
public final ListIterator<E> listIterator(int index)
{
- assertIndexInRange(index);
return new ImmutableIterator(index);
}
@@ -231,12 +230,12 @@
ImmutableIterator(int index)
{
+ if (index < 0 || index > size()) throw new IndexOutOfBoundsException("Index: " + index);
cursor = index;
}
ImmutableIterator()
{
-
}
public boolean hasNext()
Added: core/trunk/src/test/java/org/jboss/cache/util/ImmutableListCopyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/ImmutableListCopyTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/util/ImmutableListCopyTest.java 2008-07-23 15:00:08 UTC (rev 6378)
@@ -0,0 +1,144 @@
+package org.jboss.cache.util;
+
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.ListIterator;
+
+@Test(groups = "unit")
+public class ImmutableListCopyTest
+{
+ public void testImmutability()
+ {
+ List<String> l = new ImmutableListCopy<String>(Collections.singletonList("one"));
+ try
+ {
+ l.add("two");
+ assert false;
+ }
+ catch (UnsupportedOperationException good)
+ {
+
+ }
+
+ try
+ {
+ l.remove(0);
+ assert false;
+ }
+ catch (UnsupportedOperationException good)
+ {
+
+ }
+
+ try
+ {
+ l.clear();
+ assert false;
+ }
+ catch (UnsupportedOperationException good)
+ {
+
+ }
+
+ try
+ {
+ l.add(0, "x");
+ assert false;
+ }
+ catch (UnsupportedOperationException good)
+ {
+
+ }
+
+ try
+ {
+ l.set(0, "i");
+ assert false;
+ }
+ catch (UnsupportedOperationException good)
+ {
+
+ }
+
+ try
+ {
+ l.addAll(Collections.singletonList("l"));
+ assert false;
+ }
+ catch (UnsupportedOperationException good)
+ {
+
+ }
+
+ try
+ {
+ l.addAll(0, Collections.singletonList("l"));
+ assert false;
+ }
+ catch (UnsupportedOperationException good)
+ {
+
+ }
+
+ try
+ {
+ l.removeAll(Collections.singletonList("l"));
+ assert false;
+ }
+ catch (UnsupportedOperationException good)
+ {
+
+ }
+
+ try
+ {
+ l.retainAll(Collections.singletonList("l"));
+ assert false;
+ }
+ catch (UnsupportedOperationException good)
+ {
+
+ }
+
+ try
+ {
+ l.iterator().remove();
+ assert false;
+ }
+ catch (UnsupportedOperationException good)
+ {
+
+ }
+
+ try
+ {
+ l.listIterator().set("w");
+ assert false;
+ }
+ catch (UnsupportedOperationException good)
+ {
+
+ }
+ }
+
+ public void testListIterator()
+ {
+ List<Integer> ints = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+
+ List<Integer> list = new ImmutableListCopy<Integer>(ints);
+
+ ListIterator<Integer> li = list.listIterator();
+
+ int number = 1;
+ while (li.hasNext()) assert li.next() == number++;
+ assert number == 11;
+
+ number = 10;
+ li = list.listIterator(list.size());
+ while (li.hasPrevious()) assert li.previous() == number--;
+ assert number == 0;
+ }
+}
15 years, 10 months
JBoss Cache SVN: r6377 - in core/trunk/src/main/java/org/jboss/cache: buddyreplication and 6 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-23 10:23:32 -0400 (Wed, 23 Jul 2008)
New Revision: 6377
Added:
core/trunk/src/main/java/org/jboss/cache/util/ImmutableListCopy.java
core/trunk/src/main/java/org/jboss/cache/util/ImmutableMapCopy.java
core/trunk/src/main/java/org/jboss/cache/util/ImmutableSetCopy.java
Modified:
core/trunk/src/main/java/org/jboss/cache/Fqn.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyGroup.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java
core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java
core/trunk/src/main/java/org/jboss/cache/util/MapCopy.java
Log:
Implemented efficient custom collections in place of immutable and defensively copied collections
Modified: core/trunk/src/main/java/org/jboss/cache/Fqn.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Fqn.java 2008-07-23 13:46:30 UTC (rev 6376)
+++ core/trunk/src/main/java/org/jboss/cache/Fqn.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -8,6 +8,7 @@
import net.jcip.annotations.Immutable;
+import org.jboss.cache.util.ImmutableListCopy;
import java.io.Externalizable;
import java.io.IOException;
@@ -112,13 +113,9 @@
{
if (names != null)
{
+ assertNoWhiteSpace(names);
// if not safe make a defensive copy
- elements = safe ? names : new ArrayList<Object>(names);
- if (elements.size() > 0)
- {
- if (SEPARATOR.equals(elements.get(0))) elements.remove(0);
- if ("".equals(elements.get(0))) elements.remove(0);
- }
+ elements = safe ? names : new ImmutableListCopy<Object>(names);
size = elements.size();
}
else
@@ -128,12 +125,15 @@
}
}
+ private void assertNoWhiteSpace(List<Object> l)
+ {
+ if (l.contains("") || l.contains(SEPARATOR))
+ throw new IllegalArgumentException("Fqn list cannot contain whitespace or the [" + SEPARATOR + "] character!");
+ }
+
protected Fqn(Fqn base, List<Object> relative)
{
- List<Object> elements = new ArrayList<Object>(base.elements.size() + relative.size());
- elements.addAll(base.elements);
- elements.addAll(relative);
- this.elements = elements;
+ elements = new ImmutableListCopy<Object>(base.elements, relative);
size = elements.size();
}
@@ -235,12 +235,12 @@
@SuppressWarnings("unchecked")
public static Fqn fromString(String stringRepresentation)
{
- if (stringRepresentation == null || stringRepresentation.equals(SEPARATOR))
- {
+ if (stringRepresentation == null || stringRepresentation.equals(SEPARATOR) || stringRepresentation.equals(""))
return root();
- }
- List elements = Arrays.asList(stringRepresentation.split("/"));
- return new Fqn(elements, false);
+
+ String toMatch = stringRepresentation.startsWith(SEPARATOR) ? stringRepresentation.substring(1) : stringRepresentation;
+ Object[] el = toMatch.split("/");
+ return new Fqn(new ImmutableListCopy(el), true);
}
/**
@@ -434,7 +434,7 @@
*/
public boolean isDirectChildOf(Fqn parentFqn)
{
- return size == parentFqn.size() - 1 && isChildOf(parentFqn);
+ return size == parentFqn.size() + 1 && isChildOf(parentFqn);
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-23 13:46:30 UTC (rev 6376)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -16,8 +16,8 @@
import org.jboss.cache.marshall.MarshalledValue;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
+import org.jboss.cache.util.ImmutableSetCopy;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -417,7 +417,7 @@
{
return Collections.emptySet();
}
- return Collections.unmodifiableSet(new HashSet<K>(data.keySet()));
+ return new ImmutableSetCopy<K>(data.keySet());
}
public boolean removeChild(Object childName)
@@ -567,7 +567,7 @@
{
if (children != null && !children.isEmpty())
{
- return Collections.unmodifiableSet(new HashSet<NodeSPI<K, V>>((Collection) children.values()));
+ return new ImmutableSetCopy(children.values());
}
else
{
Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyGroup.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyGroup.java 2008-07-23 13:46:30 UTC (rev 6376)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyGroup.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -7,12 +7,11 @@
package org.jboss.cache.buddyreplication;
import net.jcip.annotations.ThreadSafe;
+import org.jboss.cache.util.ImmutableListCopy;
import org.jgroups.Address;
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Vector;
@@ -66,7 +65,7 @@
public List<Address> getBuddies()
{
// defensive copy and immutable.
- return Collections.unmodifiableList(new ArrayList<Address>(buddies));
+ return new ImmutableListCopy<Address>(buddies);
}
protected void addBuddies(Collection<Address> buddies)
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java 2008-07-23 13:46:30 UTC (rev 6376)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetDataMapCommand.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -4,7 +4,7 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.commands.Visitor;
import org.jboss.cache.invocation.InvocationContext;
-import org.jboss.cache.util.MapCopy;
+import org.jboss.cache.util.ImmutableMapCopy;
/**
* Implements functionality defined by {@link org.jboss.cache.Cache#getData(org.jboss.cache.Fqn)}
@@ -37,7 +37,7 @@
{
NodeSPI n = ctx.lookUpNode(fqn);
if (n == null || n.isDeleted()) return null;
- return new MapCopy(n.getDataDirect());
+ return new ImmutableMapCopy(n.getDataDirect());
}
public Object acceptVisitor(InvocationContext ctx, Visitor visitor) throws Throwable
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java 2008-07-23 13:46:30 UTC (rev 6376)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/AbstractInvocationContext.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -14,9 +14,9 @@
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionContext;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.cache.util.ImmutableListCopy;
import javax.transaction.Transaction;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
@@ -118,7 +118,7 @@
{
// first check transactional scope
if (transactionContext != null) return transactionContext.getLocks();
- return invocationLocks == null || invocationLocks.isEmpty() ? Collections.emptyList() : Collections.unmodifiableList(new ArrayList(invocationLocks));
+ return invocationLocks == null || invocationLocks.isEmpty() ? Collections.emptyList() : new ImmutableListCopy(invocationLocks);
}
@SuppressWarnings("unchecked")
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-07-23 13:46:30 UTC (rev 6376)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -40,12 +40,12 @@
import org.jboss.cache.statetransfer.StateTransferManager;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.cache.util.ImmutableSetCopy;
import org.jgroups.Address;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -543,7 +543,7 @@
GetChildrenNamesCommand command = commandsFactory.buildGetChildrenNamesCommand(fqn);
Set<Object> retval = (Set<Object>) invoker.invoke(ctx, command);
if (retval != null)
- retval = Collections.unmodifiableSet(new HashSet<Object>(retval));
+ retval = new ImmutableSetCopy<Object>(retval);
else
retval = Collections.emptySet();
return retval;
Modified: core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-07-23 13:46:30 UTC (rev 6376)
+++ core/trunk/src/main/java/org/jboss/cache/loader/AbstractCacheLoader.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -20,7 +20,7 @@
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.marshall.NodeDataExceptionMarker;
import org.jboss.cache.marshall.NodeDataMarker;
-import org.jboss.cache.util.MapCopy;
+import org.jboss.cache.util.ImmutableMapCopy;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -64,7 +64,7 @@
}
// JBCACHE-769 -- make a defensive copy
- Map<Object, Object> attrs = (attributes == null ? null : new MapCopy<Object, Object>(attributes));
+ Map<Object, Object> attrs = (attributes == null ? null : new ImmutableMapCopy<Object, Object>(attributes));
put(fqn, attrs);
}
Modified: core/trunk/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java 2008-07-23 13:46:30 UTC (rev 6376)
+++ core/trunk/src/main/java/org/jboss/cache/loader/AsyncCacheLoader.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -9,7 +9,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-import org.jboss.cache.util.MapCopy;
+import org.jboss.cache.util.ImmutableMapCopy;
import java.io.IOException;
import java.util.ArrayList;
@@ -182,7 +182,7 @@
if (config.getUseAsyncPut())
{
// JBCACHE-769 -- make a defensive copy
- Map attrs = (attributes == null ? null : new MapCopy(attributes));
+ Map attrs = (attributes == null ? null : new ImmutableMapCopy(attributes));
Modification mod = new Modification(Modification.ModificationType.PUT_DATA, name, attrs);
enqueue(mod);
}
Modified: core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2008-07-23 13:46:30 UTC (rev 6376)
+++ core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -24,7 +24,7 @@
import org.jboss.cache.notifications.annotation.*;
import org.jboss.cache.notifications.event.*;
import static org.jboss.cache.notifications.event.Event.Type.*;
-import org.jboss.cache.util.MapCopy;
+import org.jboss.cache.util.ImmutableMapCopy;
import org.jgroups.View;
import javax.transaction.Transaction;
@@ -539,7 +539,7 @@
if (data == null) return null;
if (data.isEmpty()) return Collections.emptyMap();
if (safe(data)) return useMarshalledValueMaps ? new MarshalledValueMap(data) : data;
- Map defensivelyCopiedData = new MapCopy(data);
+ Map defensivelyCopiedData = new ImmutableMapCopy(data);
return useMarshalledValueMaps ? new MarshalledValueMap(defensivelyCopiedData) : defensivelyCopiedData;
}
@@ -566,7 +566,7 @@
* A map is deemed 'safe' to be passed as-is to a listener, if either of the following are true:
* <ul>
* <li>It is null</li>
- * <li>It is an instance of {@link org.jboss.cache.util.MapCopy}, which is immutable</li>
+ * <li>It is an instance of {@link org.jboss.cache.util.ImmutableMapCopy}, which is immutable</li>
* <li>It is an instance of {@link java.util.Collections#emptyMap()}, which is also immutable</li>
* <li>It is an instance of {@link java.util.Collections#singletonMap(Object,Object)}, which is also immutable</li>
* </ul>
@@ -576,7 +576,7 @@
*/
private static boolean safe(Map map)
{
- return map == null || map instanceof MapCopy || map.getClass().equals(emptyMap) || map.getClass().equals(singletonMap);
+ return map == null || map instanceof ImmutableMapCopy || map.getClass().equals(emptyMap) || map.getClass().equals(singletonMap);
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java 2008-07-23 13:46:30 UTC (rev 6376)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/PessimisticTransactionContext.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -13,6 +13,7 @@
import org.jboss.cache.commands.WriteCommand;
import org.jboss.cache.config.Option;
import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
+import org.jboss.cache.util.ImmutableListCopy;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
@@ -170,7 +171,7 @@
@SuppressWarnings("unchecked")
public List getLocks()
{
- return transactionLocks == null || transactionLocks.isEmpty() ? Collections.emptyList() : Collections.unmodifiableList(new ArrayList(transactionLocks));
+ return transactionLocks == null || transactionLocks.isEmpty() ? Collections.emptyList() : new ImmutableListCopy(transactionLocks);
}
Added: core/trunk/src/main/java/org/jboss/cache/util/ImmutableListCopy.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/ImmutableListCopy.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/util/ImmutableListCopy.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -0,0 +1,428 @@
+package org.jboss.cache.util;
+
+import net.jcip.annotations.Immutable;
+
+import java.lang.reflect.Array;
+import java.util.AbstractList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+/**
+ * A lightweight, read-only copy of a List. Typically used in place of the common idiom:
+ * <code>
+ * return Collections.unmodifiableList(new ArrayList( myInternalList ));
+ * </code>
+ * <p/>
+ * a it is far more efficient than making a defensive copy and then wrapping the defensive copy in a read-only wrapper.
+ * <p/>
+ * Also used whenever a read-only reference List is needed (such as in Fqns).
+ * <p/>
+ *
+ * @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
+ * @since 3.0
+ */
+@Immutable
+public class ImmutableListCopy<E> extends AbstractList<E>
+{
+ private final E[] elements;
+ private final int size;
+
+ /**
+ * Only one copy constructor since the list is immutable.
+ *
+ * @param c collection to copy from
+ */
+ @SuppressWarnings("unchecked")
+ public ImmutableListCopy(Collection<? extends E> c)
+ {
+ size = c.size();
+ Object[] el = new Object[size]; // no room for growth;
+ el = c.toArray(el);
+ elements = (E[]) el;
+ }
+
+ /**
+ * Assumes that the array passed in is "safe", i.e., is not referenced from elsewhere. Use with care!
+ *
+ * @param array to reference
+ */
+ public ImmutableListCopy(E[] array)
+ {
+ size = array.length;
+ elements = array;
+ }
+
+ /**
+ * Utility constructors to allow combining collections
+ *
+ * @param collection1 collection to copy from
+ * @param collection2 collection to copy from
+ */
+ @SuppressWarnings("unchecked")
+ public ImmutableListCopy(Collection<? extends E> collection1, Collection<? extends E> collection2)
+ {
+ size = collection1.size() + collection2.size();
+ elements = (E[]) new Object[size]; // no room for growth;
+ Object[] c1 = new Object[collection1.size()];
+ Object[] c2 = new Object[collection2.size()];
+ c1 = collection1.toArray(c1);
+ c2 = collection2.toArray(c2);
+ System.arraycopy(c1, 0, elements, 0, c1.length);
+ System.arraycopy(c2, 0, elements, c1.length, c2.length);
+ }
+
+ @Override
+ public final int size()
+ {
+ return size;
+ }
+
+ @Override
+ public final boolean isEmpty()
+ {
+ return size == 0;
+ }
+
+ @Override
+ public final boolean contains(Object o)
+ {
+ return indexOf(o) >= 0;
+ }
+
+ @Override
+ public final Iterator<E> iterator()
+ {
+ return new ImmutableIterator();
+ }
+
+ @Override
+ public final Object[] toArray()
+ {
+ Object[] result = new Object[size];
+ System.arraycopy(elements, 0, result, 0, size);
+ return result;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public final <T> T[] toArray(T[] a)
+ {
+ if (a.length < size)
+ {
+ a = (T[]) Array.newInstance(a.getClass().getComponentType(), size);
+ }
+ System.arraycopy(elements, 0, a, 0, size);
+ if (a.length > size) a[size] = null;
+ return a;
+ }
+
+ @Override
+ public final boolean add(E o)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final boolean remove(Object o)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final boolean addAll(Collection<? extends E> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final boolean addAll(int index, Collection<? extends E> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final boolean removeAll(Collection<?> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final boolean retainAll(Collection<?> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public final E get(int index)
+ {
+ assertIndexInRange(index);
+ return elements[index];
+ }
+
+ @Override
+ public final int indexOf(Object o)
+ {
+ if (o == null)
+ {
+ for (int i = 0; i < size; i++)
+ {
+ if (elements[i] == null) return i;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < size; i++)
+ {
+ if (o.equals(elements[i])) return i;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public final int lastIndexOf(Object o)
+ {
+ if (o == null)
+ {
+ for (int i = size - 1; i >= 0; i--)
+ {
+ if (elements[i] == null) return i;
+ }
+ }
+ else
+ {
+ for (int i = size - 1; i >= 0; i--)
+ {
+ if (o.equals(elements[i])) return i;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public final ListIterator<E> listIterator()
+ {
+ return listIterator(0);
+ }
+
+ @Override
+ public final ListIterator<E> listIterator(int index)
+ {
+ assertIndexInRange(index);
+ return new ImmutableIterator(index);
+ }
+
+ @Override
+ public final List<E> subList(int fromIndex, int toIndex)
+ {
+ return new ImmutableSubList<E>(fromIndex, toIndex);
+ }
+
+ private void assertIndexInRange(int index)
+ {
+ if (index >= size || index < 0) throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size);
+ }
+
+ private class ImmutableIterator implements ListIterator<E>
+ {
+ int cursor = 0;
+
+ ImmutableIterator(int index)
+ {
+ cursor = index;
+ }
+
+ ImmutableIterator()
+ {
+
+ }
+
+ public boolean hasNext()
+ {
+ return cursor != size;
+ }
+
+ public E next()
+ {
+ try
+ {
+ return get(cursor++);
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ throw new NoSuchElementException();
+ }
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean hasPrevious()
+ {
+ return cursor != 0;
+ }
+
+ public E previous()
+ {
+ try
+ {
+ return get(--cursor);
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ throw new NoSuchElementException();
+ }
+ }
+
+ public int nextIndex()
+ {
+ return cursor;
+ }
+
+ public int previousIndex()
+ {
+ return cursor - 1;
+ }
+
+ public void set(E o)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void add(E o)
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ private class ImmutableSubList<E> extends AbstractList<E>
+ {
+ private int offset;
+ private int size;
+
+ ImmutableSubList(int fromIndex, int toIndex)
+ {
+ assertIndexInRange(fromIndex);
+ assertIndexInRange(toIndex - 1);
+ if (fromIndex > toIndex)
+ throw new IllegalArgumentException("fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
+ offset = fromIndex;
+ size = toIndex - fromIndex;
+ }
+
+ @SuppressWarnings("unchecked")
+ public final E get(int index)
+ {
+ rangeCheck(index);
+ return (E) ImmutableListCopy.this.get(index + offset);
+ }
+
+ private void rangeCheck(int index)
+ {
+ if (index < 0 || index >= size) throw new IndexOutOfBoundsException("Index: " + index + ",Size: " + size);
+ }
+
+ public final int size()
+ {
+ return size;
+ }
+
+ @Override
+ protected final void removeRange(int fromIndex, int toIndex)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final boolean addAll(Collection<? extends E> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final boolean addAll(int index, Collection<? extends E> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final Iterator<E> iterator()
+ {
+ return listIterator();
+ }
+
+ @Override
+ public final ListIterator<E> listIterator(final int index)
+ {
+ rangeCheck(index);
+
+ return new ListIterator<E>()
+ {
+ private ListIterator i = ImmutableListCopy.this.listIterator(index + offset);
+
+ public boolean hasNext()
+ {
+ return nextIndex() < size;
+ }
+
+ @SuppressWarnings("unchecked")
+ public E next()
+ {
+ if (hasNext())
+ return (E) i.next();
+ else
+ throw new NoSuchElementException();
+ }
+
+ public boolean hasPrevious()
+ {
+ return previousIndex() >= 0;
+ }
+
+ @SuppressWarnings("unchecked")
+ public E previous()
+ {
+ if (hasPrevious())
+ return (E) i.previous();
+ else
+ throw new NoSuchElementException();
+ }
+
+ public int nextIndex()
+ {
+ return i.nextIndex() - offset;
+ }
+
+ public int previousIndex()
+ {
+ return i.previousIndex() - offset;
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void set(E o)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void add(E o)
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+ @Override
+ public final List<E> subList(int fromIndex, int toIndex)
+ {
+ return new ImmutableSubList<E>(offset + fromIndex, offset + toIndex);
+ }
+ }
+}
Added: core/trunk/src/main/java/org/jboss/cache/util/ImmutableMapCopy.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/ImmutableMapCopy.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/util/ImmutableMapCopy.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -0,0 +1,95 @@
+package org.jboss.cache.util;
+
+import net.jcip.annotations.Immutable;
+
+import java.util.AbstractMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Along the lines of ImmutableListCopy and ImmutableSetCopy. This lightweight wrapper primarily meant for iteration.
+ * performance of get() and containsKey() are not as efficient as that of a {@link java.util.HashMap}, but iteration is
+ * fast since the entry table is a fixed size immutable array.
+ * <p/>
+ * Typically used in place of the common idiom:
+ * <code>
+ * return Collections.unmodifiableMap(new HashMap( myInternalMap ));
+ * </code>
+ *
+ * @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
+ * @since 3.0
+ */
+@Immutable
+public class ImmutableMapCopy<K, V> extends AbstractMap<K, V>
+{
+ private final Entry<K, V>[] table;
+ private final int size;
+
+ @SuppressWarnings("unchecked")
+ public ImmutableMapCopy(Map<K, V> map)
+ {
+ size = map.size();
+ table = new ImmutableEntry[size];
+ int i = 0;
+ for (Map.Entry<K, V> me : map.entrySet())
+ {
+ table[i++] = new ImmutableEntry<K, V>(me);
+ }
+ }
+
+ @Override
+ public int size()
+ {
+ return size;
+ }
+
+ @Override
+ public final V remove(Object key)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final void putAll(Map<? extends K, ? extends V> t)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public final void clear()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public final Set<Entry<K, V>> entrySet()
+ {
+ return new ImmutableSetCopy<Map.Entry<K, V>>(table);
+ }
+
+ private class ImmutableEntry<K, V> implements Map.Entry<K, V>
+ {
+ K k;
+ V v;
+
+ private ImmutableEntry(Map.Entry<K, V> entry)
+ {
+ k = entry.getKey();
+ v = entry.getValue();
+ }
+
+ public K getKey()
+ {
+ return k;
+ }
+
+ public V getValue()
+ {
+ return v;
+ }
+
+ public V setValue(V value)
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
Added: core/trunk/src/main/java/org/jboss/cache/util/ImmutableSetCopy.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/ImmutableSetCopy.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/util/ImmutableSetCopy.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -0,0 +1,109 @@
+package org.jboss.cache.util;
+
+import net.jcip.annotations.Immutable;
+
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * This is based on an ImmutableListCopy, with the assumption that the set passed in would ensure uniqueness of elements.
+ * <p/>
+ * The constructor takes in a collection so the onus is on the caller to ensure that the collection passed in adheres to
+ * Set semantics.
+ * <p/>
+ * Typically used in place of the common idiom:
+ * <code>
+ * return Collections.unmodifiableSet(new HashSet( myInternalSet ));
+ * </code>
+ *
+ * @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
+ * @see org.jboss.cache.util.ImmutableListCopy
+ * @since 3.0
+ */
+@Immutable
+public class ImmutableSetCopy<E> extends AbstractSet<E>
+{
+ private final E[] elements;
+ private final int size;
+
+ @SuppressWarnings("unchecked")
+ public ImmutableSetCopy(Collection<E> set)
+ {
+ size = set.size();
+ E[] tempElements = (E[]) new Object[size]; // no room for growth
+ elements = set.toArray(tempElements);
+ }
+
+ /**
+ * Assumes that the array passed in is "safe", i.e., is not referenced from elsewhere. Also assumes the array contains
+ * elements such that the uniqueness required by a set is adhered to. Use with care!
+ *
+ * @param array to reference
+ */
+ public ImmutableSetCopy(E[] array)
+ {
+ elements = array;
+ size = elements.length;
+ }
+
+ @Override
+ public boolean remove(Object o)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends E> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void clear()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator<E> iterator()
+ {
+ return new Iterator<E>()
+ {
+ int cursor = 0;
+
+ public boolean hasNext()
+ {
+ return cursor < size;
+ }
+
+ public E next()
+ {
+ if (cursor >= size) throw new NoSuchElementException();
+ return elements[cursor++];
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+ public int size()
+ {
+ return size;
+ }
+}
Modified: core/trunk/src/main/java/org/jboss/cache/util/MapCopy.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/MapCopy.java 2008-07-23 13:46:30 UTC (rev 6376)
+++ core/trunk/src/main/java/org/jboss/cache/util/MapCopy.java 2008-07-23 14:23:32 UTC (rev 6377)
@@ -7,7 +7,7 @@
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -21,8 +21,10 @@
* {@link UnsupportedOperationException}s.
*
* @author Elias Ross
+ * @deprecated see ImmutableMapCopy instead.
*/
@Immutable
+@Deprecated
public class MapCopy<K, V> extends AbstractMap<K, V> implements Serializable
{
@@ -51,7 +53,7 @@
public MapCopy()
{
- this(new HashMap<K, V>(0));
+ this((Map<K, V>) Collections.emptyMap());
}
/**
15 years, 10 months
JBoss Cache SVN: r6376 - benchmarks/benchmark-fwk/trunk/cache-products.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-23 09:46:30 -0400 (Wed, 23 Jul 2008)
New Revision: 6376
Added:
benchmarks/benchmark-fwk/trunk/cache-products/coherence-3.3.1/
Removed:
benchmarks/benchmark-fwk/trunk/cache-products/coherence-3.2.2/
Log:
moved to newer coherence distro
Copied: benchmarks/benchmark-fwk/trunk/cache-products/coherence-3.3.1 (from rev 6374, benchmarks/benchmark-fwk/trunk/cache-products/coherence-3.2.2)
15 years, 10 months
JBoss Cache SVN: r6375 - in core/trunk/src/main/java/org/jboss/cache: buddyreplication and 4 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-23 07:03:33 -0400 (Wed, 23 Jul 2008)
New Revision: 6375
Modified:
core/trunk/src/main/java/org/jboss/cache/Fqn.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/buddyreplication/BuddyFqnTransformer.java
core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java
core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java
Log:
Performance tweaks around the usage of Fqns and Fqn.getParent()
Modified: core/trunk/src/main/java/org/jboss/cache/Fqn.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/Fqn.java 2008-07-23 05:01:02 UTC (rev 6374)
+++ core/trunk/src/main/java/org/jboss/cache/Fqn.java 2008-07-23 11:03:33 UTC (rev 6375)
@@ -425,7 +425,19 @@
return parentFqn.size() != size && isChildOrEquals(parentFqn);
}
+
/**
+ * Returns true if this Fqn is a <i>direct</i> child of a given Fqn.
+ *
+ * @param parentFqn parentFqn to compare with
+ * @return true if this is a direct child, false otherwise.
+ */
+ public boolean isDirectChildOf(Fqn parentFqn)
+ {
+ return size == parentFqn.size() - 1 && isChildOf(parentFqn);
+ }
+
+ /**
* Returns true if this Fqn is equals or the child of parentFqn.
* Example usage:
* <pre>
Modified: core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2008-07-23 05:01:02 UTC (rev 6374)
+++ core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2008-07-23 11:03:33 UTC (rev 6375)
@@ -95,7 +95,8 @@
@Override
public void addChild(NodeSPI<K, V> child)
{
- if (child.getFqn().getParent().equals(getFqn()))
+ Fqn childFqn = child.getFqn();
+ if (childFqn.isDirectChildOf(fqn))
{
synchronized (this)
{
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-23 05:01:02 UTC (rev 6374)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-07-23 11:03:33 UTC (rev 6375)
@@ -347,8 +347,7 @@
public void addChild(NodeSPI<K, V> child)
{
Fqn childFqn = child.getFqn();
- Fqn parentFqn = childFqn.getParent();
- if (parentFqn.equals(fqn))
+ if (childFqn.isDirectChildOf(fqn))
{
children().put(childFqn.getLastElement(), child);
}
Modified: core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java 2008-07-23 05:01:02 UTC (rev 6374)
+++ core/trunk/src/main/java/org/jboss/cache/buddyreplication/BuddyFqnTransformer.java 2008-07-23 11:03:33 UTC (rev 6375)
@@ -127,7 +127,7 @@
public boolean isDeadBackupRoot(Fqn f)
{
- return f.getParent().equals(BUDDY_BACKUP_SUBTREE_FQN) && f.getLastElementAsString().endsWith(":DEAD");
+ return f.isDirectChildOf(BUDDY_BACKUP_SUBTREE_FQN) && f.getLastElementAsString().endsWith(":DEAD");
}
public String getGroupNameFromAddress(Address address)
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-07-23 05:01:02 UTC (rev 6374)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GetChildrenNamesCommand.java 2008-07-23 11:03:33 UTC (rev 6375)
@@ -82,7 +82,8 @@
for (Map.Entry<Fqn, NodeSPI> n : ctx.getLookedUpNodes().entrySet())
{
Fqn childFqn = n.getKey();
- if (childFqn.getParent().equals(fqn))
+
+ if (childFqn.isDirectChildOf(fqn))
{
ReadCommittedNode childNode = (ReadCommittedNode) n.getValue();
if (childNode.isCreated()) childNames.add(childFqn.getLastElement());
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-07-23 05:01:02 UTC (rev 6374)
+++ core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-07-23 11:03:33 UTC (rev 6375)
@@ -86,7 +86,7 @@
if (wasNodeRemoved(result))
{
// 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()))
+ if (buddyFqnTransformer.isDeadBackupFqn(backup) && buddyFqnTransformer.isDeadBackupRoot(backup.getAncestor(backup.size() - 2)))
{
NodeSPI deadBackupRoot = dataContainer.peek(backup.getParent(), false); // ctx.lookUpNode(backup.getParent());
if (deadBackupRoot.getChildrenMapDirect().isEmpty())
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-07-23 05:01:02 UTC (rev 6374)
+++ core/trunk/src/main/java/org/jboss/cache/commands/write/MoveCommand.java 2008-07-23 11:03:33 UTC (rev 6375)
@@ -67,7 +67,7 @@
*/
public Object perform(InvocationContext ctx)
{
- if (to.equals(fqn.getParent()))
+ if (to.isDirectChildOf(fqn))
{
if (log.isDebugEnabled()) log.debug("Attempting to move " + fqn + " onto itself. Nothing to do.");
return null;
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java 2008-07-23 05:01:02 UTC (rev 6374)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java 2008-07-23 11:03:33 UTC (rev 6375)
@@ -168,6 +168,7 @@
*/
public ReadCommittedNode wrapNodeForWriting(InvocationContext context, Fqn fqn, boolean lockForWriting, boolean createIfAbsent, boolean includeInvalidNodes, boolean forRemoval, boolean force) throws InterruptedException
{
+ Fqn parentFqn = null;
ReadCommittedNode n = (ReadCommittedNode) context.lookUpNode(fqn);
if (createIfAbsent && n != null && n.isNullNode()) n = null;
if (n != null) // exists in context! Just acquire lock if needed, and wrap.
@@ -205,7 +206,7 @@
}
else if (createIfAbsent) // else, do we need to create one?
{
- Fqn parentFqn = fqn.getParent();
+ parentFqn = fqn.getParent();
NodeSPI parent = wrapNodeForWriting(context, parentFqn, false, createIfAbsent, false, false, false);
// do we need to lock the parent to create children?
boolean parentLockNeeded = isParentLockNeeded(parent);
@@ -236,8 +237,8 @@
if (n == null && force) acquireLock(context, fqn);
// now test if we need to lock the parent as well.
- if ((n != null || force) && forRemoval && isParentLockNeeded(fqn.getParent(), context))
- wrapNodeForWriting(context, fqn.getParent(), true, false, includeInvalidNodes, false, force);
+ if ((n != null || force) && forRemoval && (parentFqn == null ? parentFqn = fqn.getParent() : parentFqn) != null && isParentLockNeeded(parentFqn, context))
+ wrapNodeForWriting(context, parentFqn, true, false, includeInvalidNodes, false, force);
return n;
}
15 years, 10 months
JBoss Cache SVN: r6374 - in pojo/trunk/src: main/java/org/jboss/cache/pojo/impl and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: jason.greene(a)jboss.com
Date: 2008-07-23 01:01:02 -0400 (Wed, 23 Jul 2008)
New Revision: 6374
Added:
pojo/trunk/src/main/java/org/jboss/cache/pojo/Reference.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ReferenceImpl.java
pojo/trunk/src/test/java/org/jboss/cache/pojo/FindReferencesTest.java
Removed:
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/Referrer.java
Modified:
pojo/trunk/src/main/java/org/jboss/cache/pojo/PojoCache.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AbstractHandler.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ArrayHandler.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/CollectionClassHandler.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalHelper.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/MethodDeclarations.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/NotificationDispatcher.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ObjectGraphHandler.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheImpl.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoInstance.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoUtil.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/SerializableObjectHandler.java
pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java
Log:
PCACHE-72 - Implement PojoCache.getInternalFqn and PojoCache.getReferences
Thanks to Dan Berindei!
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/PojoCache.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/PojoCache.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/PojoCache.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -7,6 +7,7 @@
package org.jboss.cache.pojo;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
@@ -103,15 +104,41 @@
*/
Object detach(Fqn<?> id) throws PojoCacheException;
- /**
- * Return the POJO id that is associated with PojoCache. Note that if a POJO has not yet
- * attached to the cache system, it will simply return null.
- *
- * @param pojo The POJO that is attached to PojoCache.
- * @return String ID. Null if not existed.
- */
- String getPojoID(Object pojo);
+ /**
+ * Return the <code>Fqn</code> of the internal node containing the data of this attached object.
+ * <p>
+ * Note that if the object is not attached to the cache system, this method will simply return
+ * null. Same for any object of an immediate type (primitive wrapper types, String, or Class) or
+ * of any <code>Serializable</code> types.
+ * </p>
+ *
+ * @param object Any object.
+ * @return <code>Fqn</code> of the internal data node. <code>null</code> if the object is
+ * immediate, serializable, or not in the cache.
+ */
+ Fqn<?> getInternalFqn(Object object);
+ /**
+ * Return a list of the references from attached objects to this object. For each reference it
+ * returns a {@link Reference} object containing the <code>Fqn</code> of the referrer object and
+ * the name of the field that contains the reference.
+ * <p>
+ * If the node is not attached to the cache, this method will return an empty list. Same for any
+ * object of an immediate type (primitive wrapper types, String, or Class) or of any
+ * <code>Serializable</code> types.
+ * </p>
+ * <p>
+ * For external references (i.e. when the object was directly attached to the cache by user code)
+ * the <code>Reference.fieldName</code> property is <code>null</code>. Otherwise it is the name
+ * of the field that contains the reference to this object.
+ * </p>
+ *
+ * @param object Any object.
+ * @return Collection of internal references to the given object. Empty collection if the object is
+ * immediate, serializable, or not in the cache.
+ */
+ Collection<Reference> getReferences(Object object);
+
/**
* Determines if an object is attached at a particular location. This is somewhat less expensive
* than find() because an object is not created, and internal reference links are not traversed.
Added: pojo/trunk/src/main/java/org/jboss/cache/pojo/Reference.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/Reference.java (rev 0)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/Reference.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.cache.pojo;
+
+import org.jboss.cache.Fqn;
+
+/**
+ * A reference to an attached object. This class represents both normal Fqn aliases, and
+ * references from other attached objects.
+ *
+ * @author Dan Berindei <dan.berindei(a)gmail.com>
+ */
+public interface Reference
+{
+ /**
+ * Returns the Fqn of the referring node. Cannot be <code>null</code>.
+ *
+ * @return <code>Fqn</code> of the referring node.
+ */
+ public Fqn<?> getFqn();
+
+ /**
+ * Returns the name of the node key which references the attached object, or null
+ * if the Fqn is a normal alias to the internal node. If there is a key, then this is
+ * typically a field name or collection index.
+ *
+ * @return Name of the field or key/index in the collection that is containing the reference.
+ */
+ public String getKey();
+}
\ No newline at end of file
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AbstractHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AbstractHandler.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AbstractHandler.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -22,6 +22,7 @@
package org.jboss.cache.pojo.impl;
import org.jboss.cache.Fqn;
+import org.jboss.cache.pojo.Reference;
abstract class AbstractHandler
{
@@ -30,14 +31,14 @@
{
super();
}
-
+
protected abstract boolean handles(Class<?> clazz);
- protected abstract Object remove(Fqn<?> fqn, Fqn<?> referenceingFqn, Object result);
+ protected abstract Object remove(Fqn<?> fqn, Reference reference, Object result);
- protected abstract void put(Fqn<?> fqn, Fqn<?> referencingFqn, Object obj);
+ protected abstract void put(Fqn<?> fqn, Reference reference, Object obj);
protected abstract Object get(Fqn<?> fqn, Class<?> clazz, PojoInstance pojoInstance);
protected abstract Fqn<?> getFqn(Object obj);
-}
\ No newline at end of file
+}
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/AdvisedPojoHandler.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -22,11 +22,7 @@
package org.jboss.cache.pojo.impl;
import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -37,6 +33,7 @@
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.pojo.PojoCacheException;
+import org.jboss.cache.pojo.Reference;
import org.jboss.cache.pojo.interceptors.dynamic.BaseInterceptor;
import org.jboss.cache.pojo.interceptors.dynamic.CacheFieldInterceptor;
import org.jboss.cache.pojo.memory.FieldPersistentReference;
@@ -120,7 +117,7 @@
}
@Override
- protected void put(Fqn<?> fqn, Fqn<?> referencingFqn, Object obj) throws CacheException
+ protected void put(Fqn<?> fqn, Reference reference, Object obj) throws CacheException
{
CachedType type = pCache_.getCachedType(obj.getClass());
// We have a clean slate then.
@@ -135,7 +132,7 @@
// Let's do batch update via Map instead
Map map = new HashMap();
// Always initialize the ref count so we can mark this as an AopNode.
- PojoInstance pojoInstance = InternalHelper.initializeAopInstance(referencingFqn);
+ PojoInstance pojoInstance = InternalHelper.initializeAopInstance(reference);
map.put(PojoInstance.KEY, pojoInstance);
pojoInstance.setPojoClass(type.getType());
// we will do it recursively.
@@ -205,7 +202,7 @@
}
@Override
- protected Object remove(Fqn<?> fqn, Fqn<?> referencingFqn, Object result) throws CacheException
+ protected Object remove(Fqn<?> fqn, Reference referencingFqn, Object result) throws CacheException
{
CachedType type = pCache_.getCachedType(result.getClass());
InstanceAdvisor advisor = ((Advised) result)._getInstanceAdvisor();
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ArrayHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ArrayHandler.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ArrayHandler.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -22,6 +22,7 @@
package org.jboss.cache.pojo.impl;
import org.jboss.cache.Fqn;
+import org.jboss.cache.pojo.Reference;
import org.jboss.cache.pojo.collection.CachedArray;
import org.jboss.cache.pojo.collection.CachedArrayRegistry;
@@ -46,11 +47,11 @@
return cached != null ? cached.getFqn() : null;
}
-
- protected void put(Fqn<?> fqn, Fqn<?> referencingFqn, Object obj)
+ @Override
+ protected void put(Fqn<?> fqn, Reference reference, Object obj)
{
// Always initialize the ref count so that we can mark this as an AopNode.
- PojoInstance pojoInstance = InternalHelper.initializeAopInstance(referencingFqn);
+ PojoInstance pojoInstance = InternalHelper.initializeAopInstance(reference);
pojoInstance.set(obj);
pojoInstance.setPojoClass(obj.getClass());
cache.getCache().put(fqn, PojoInstance.KEY, pojoInstance);
@@ -70,7 +71,7 @@
}
@Override
- protected Object remove(Fqn<?> fqn, Fqn<?> referencingFqn, Object obj)
+ protected Object remove(Fqn<?> fqn, Reference referencingFqn, Object obj)
{
CachedArray cached = CachedArrayRegistry.lookup(obj);
if (cached != null) {
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/CollectionClassHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/CollectionClassHandler.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/CollectionClassHandler.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -7,11 +7,7 @@
package org.jboss.cache.pojo.impl;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -20,6 +16,7 @@
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.pojo.PojoCacheException;
+import org.jboss.cache.pojo.Reference;
import org.jboss.cache.pojo.collection.CollectionInterceptorUtil;
import org.jboss.cache.pojo.interceptors.dynamic.AbstractCollectionInterceptor;
import org.jboss.cache.pojo.interceptors.dynamic.BaseInterceptor;
@@ -84,7 +81,7 @@
return obj;
}
- protected void put(Fqn fqn, Fqn referencingFqn, Object obj) throws CacheException
+ protected void put(Fqn fqn, Reference reference, Object obj) throws CacheException
{
boolean isCollection = false;
@@ -103,7 +100,7 @@
}
// Always initialize the ref count so that we can mark this as an AopNode.
- PojoInstance pojoInstance = InternalHelper.initializeAopInstance(referencingFqn);
+ PojoInstance pojoInstance = InternalHelper.initializeAopInstance(reference);
pojoInstance.set(obj);
pojoInstance.setPojoClass(type.getType());
cache_.put(fqn, PojoInstance.KEY, pojoInstance);
@@ -269,7 +266,7 @@
}
@Override
- protected Object remove(Fqn<?> fqn, Fqn<?> referencingFqn, Object obj) throws CacheException
+ protected Object remove(Fqn<?> fqn, Reference referencingFqn, Object obj) throws CacheException
{
if (!(obj instanceof ClassProxy))
{
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalHelper.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalHelper.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/InternalHelper.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -10,12 +10,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
+import org.jboss.cache.*;
import org.jboss.cache.lock.UpgradeException;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.PojoCacheException;
+import org.jboss.cache.pojo.*;
import org.jboss.cache.pojo.util.ObjectUtil;
/**
@@ -56,24 +53,25 @@
}
- static PojoInstance initializeAopInstance(Fqn sourceFqn)
+ static PojoInstance initializeAopInstance(Reference reference)
{
PojoInstance pojoInstance = new PojoInstance();
- pojoInstance.incrementRefCount(sourceFqn);
+ pojoInstance.incrementRefCount(reference);
return pojoInstance;
}
/**
* Increment reference count for the pojo. Note that this is not thread safe or atomic.
+ * @param reference TODO
*/
- int incrementRefCount(Fqn originalFqn, Fqn referencingFqn) throws CacheException
+ int incrementRefCount(Fqn originalFqn, Reference reference) throws CacheException
{
PojoInstance pojoInstance = getPojoInstance(originalFqn);
if (pojoInstance == null)
throw new PojoCacheException("InternalDelegate.incrementRefCount(): null pojoReference for fqn: " + originalFqn);
- int count = pojoInstance.incrementRefCount(referencingFqn);
+ int count = pojoInstance.incrementRefCount(reference);
// need to update it.
put(originalFqn, PojoInstance.KEY, pojoInstance);
return count;
@@ -116,13 +114,13 @@
/**
* decrement reference count for the pojo. Note that this is not thread safe or atomic.
*/
- int decrementRefCount(Fqn originalFqn, Fqn referencingFqn) throws CacheException
+ int decrementRefCount(Fqn originalFqn, Reference reference) throws CacheException
{
PojoInstance pojoInstance = getPojoInstance(originalFqn);
if (pojoInstance == null)
throw new PojoCacheException("InternalDelegate.decrementRefCount(): null pojoReference.");
- int count = pojoInstance.decrementRefCount(referencingFqn);
+ int count = pojoInstance.decrementRefCount(reference);
if (count < -1) // can't dip below -1
throw new PojoCacheException("InternalDelegate.decrementRefCount(): null pojoReference.");
@@ -138,49 +136,6 @@
return (pojoInstance.getRefCount() > 0);
}
- int getRefCount(Fqn fqn) throws CacheException
- {
- return getPojoInstance(fqn).getRefCount();
- }
-
- String XgetRefFqn(Fqn fqn) throws CacheException
- {
- PojoInstance pojoInstance = getPojoInstance(fqn);
- return getRefFqn(pojoInstance);
- }
-
- String getRefFqn(PojoInstance pojoInstance) throws CacheException
- {
- if (pojoInstance == null)
- return null;
-
- String aliasFqn = pojoInstance.getInternalFqn();
-
- if (aliasFqn == null || aliasFqn.length() == 0) return null;
-
- return getRefFqnFromAlias(aliasFqn);
- }
-
- void setRefFqn(Fqn fqn, String internalFqn) throws CacheException
- {
- PojoInstance pojoInstance = getPojoInstance(fqn);
- if (pojoInstance == null)
- pojoInstance = new PojoInstance();
-
- pojoInstance.setInternalFqn(internalFqn);
- put(fqn, PojoInstance.KEY, pojoInstance);
- }
-
- void removeRefFqn(Fqn fqn) throws CacheException
- {
- PojoInstance pojoInstance = getPojoInstance(fqn);
- if (pojoInstance == null)
- throw new PojoCacheException("InternalDelegate.getInternalFqn(): null pojoReference.");
-
- pojoInstance.removeInternalFqn();
- put(fqn, PojoInstance.KEY, pojoInstance);
- }
-
Object getPojo(Fqn fqn, String field) throws CacheException
{
PojoReference pojoReference = getPojoReference(fqn, field);
@@ -357,12 +312,6 @@
return (String) get(getInternalFqn(aliasFqn), aliasFqn, true);
}
- Fqn getNextFqnInLine(Fqn currentFqn) throws CacheException
- {
- PojoInstance ai = getPojoInstance(currentFqn);
- return ai.getAndRemoveFirstFqnInList();
- }
-
/**
* Test if this internal node.
*
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/MethodDeclarations.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/MethodDeclarations.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/MethodDeclarations.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -9,11 +9,11 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.util.List;
+import java.util.Set;
import org.jboss.aop.InstanceAdvisor;
import org.jboss.aop.advice.Interceptor;
-import org.jboss.cache.Fqn;
+import org.jboss.cache.pojo.Reference;
import org.jboss.cache.pojo.collection.CachedArray;
import org.jboss.cache.pojo.interceptors.dynamic.AbstractCollectionInterceptor;
@@ -67,13 +67,13 @@
undoInMemorySubstitution = PojoUtil.class.getDeclaredMethod("undoInMemorySubstitution",
new Class[]{Object.class, Field.class, Object.class});
incrementReferenceCount = PojoUtil.class.getDeclaredMethod("incrementReferenceCount",
- new Class[]{Fqn.class, int.class, List.class});
+ new Class[]{Reference.class, int.class, Set.class});
decrementReferenceCount = PojoUtil.class.getDeclaredMethod("decrementReferenceCount",
- new Class[]{Fqn.class, int.class, List.class});
+ new Class[]{Reference.class, int.class, Set.class});
undoIncrementReferenceCount = PojoUtil.class.getDeclaredMethod("undoIncrementReferenceCount",
- new Class[]{Fqn.class, int.class, List.class});
+ new Class[]{Reference.class, int.class, Set.class});
undoDecrementReferenceCount = PojoUtil.class.getDeclaredMethod("undoDecrementReferenceCount",
- new Class[]{Fqn.class, int.class, List.class});
+ new Class[]{Reference.class, int.class, Set.class});
attachArray = PojoUtil.class.getDeclaredMethod("attachArray", new Class[]{Object.class, CachedArray.class});
detachArray = PojoUtil.class.getDeclaredMethod("detachArray", new Class[]{Object.class, CachedArray.class});
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/NotificationDispatcher.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/NotificationDispatcher.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/NotificationDispatcher.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -25,18 +25,13 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.regex.Pattern;
import org.jboss.cache.Fqn;
import org.jboss.cache.pojo.PojoCacheException;
+import org.jboss.cache.pojo.Reference;
import org.jboss.cache.pojo.notification.annotation.ArrayModified;
import org.jboss.cache.pojo.notification.annotation.Attached;
import org.jboss.cache.pojo.notification.annotation.Detached;
@@ -204,7 +199,7 @@
return Collections.unmodifiableSet(set);
}
- Set<Entry> getListenerEntries(List<Fqn> fqns)
+ Set<Entry> getListenerEntries(Collection<Reference> references)
{
Set<Entry> set = new HashSet<Entry>();
for (Entry entry : listeners)
@@ -215,9 +210,9 @@
continue;
}
- for (Fqn fqn : fqns)
+ for (Reference reference : references)
{
- if (entry.pattern.matcher(fqn.toString()).matches())
+ if (entry.pattern.matcher(reference.getFqn().toString()).matches())
{
set.add(entry);
break;
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ObjectGraphHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ObjectGraphHandler.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ObjectGraphHandler.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -12,6 +12,7 @@
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.pojo.PojoCacheException;
+import org.jboss.cache.pojo.Reference;
/**
* Handle the object graph management.
@@ -57,9 +58,9 @@
}
@Override
- protected void put(Fqn<?> fqn, Fqn<?> referencingFqn, Object obj) throws CacheException
+ protected void put(Fqn<?> fqn, Reference reference, Object obj) throws CacheException
{
- setupRefCounting(fqn, referencingFqn);
+ setupRefCounting(fqn, reference);
}
boolean isMultipleReferenced(Fqn<?> internalFqn)
@@ -80,15 +81,15 @@
}
@Override
- protected Object remove(Fqn<?> fqn, Fqn<?> referencingFqn, Object pojo)
+ protected Object remove(Fqn<?> fqn, Reference reference, Object pojo)
throws CacheException
{
if (log.isDebugEnabled())
{
- log.debug("remove(): removing object fqn: " + referencingFqn
+ log.debug("remove(): removing object fqn: " + reference
+ " Will just de-reference it.");
}
- removeFromReference(fqn, referencingFqn);
+ removeFromReference(fqn, reference);
return null;
}
@@ -96,12 +97,12 @@
/**
* Remove the object from the the reference fqn, meaning just decrement the ref counter.
*/
- private void removeFromReference(Fqn<?> originalFqn, Fqn<?> referencingFqn) throws CacheException
+ private void removeFromReference(Fqn<?> originalFqn, Reference reference) throws CacheException
{
synchronized (originalFqn)
{ // we lock the internal fqn here so no one else has access.
// Decrement ref counting on the internal node
- if (decrementRefCount(originalFqn, referencingFqn) == PojoInstance.INITIAL_COUNTER_VALUE)
+ if (decrementRefCount(originalFqn, reference) == PojoInstance.INITIAL_COUNTER_VALUE)
{
// No one is referring it so it is safe to remove
// TODO we should make sure the parent nodes are also removed they are empty as well.
@@ -117,22 +118,22 @@
* @param fqn The original fqn node
* @param refFqn The new internal fqn node
*/
- private void setupRefCounting(Fqn<?> fqn, Fqn<?> referencingFqn) throws CacheException
+ private void setupRefCounting(Fqn<?> fqn, Reference reference) throws CacheException
{
synchronized (fqn)
{
// increment the reference counting
- incrementRefCount(fqn, referencingFqn);
+ incrementRefCount(fqn, reference);
}
}
- private int incrementRefCount(Fqn<?> originalFqn, Fqn<?> referencingFqn) throws CacheException
+ private int incrementRefCount(Fqn<?> originalFqn, Reference reference) throws CacheException
{
- return internal_.incrementRefCount(originalFqn, referencingFqn);
+ return internal_.incrementRefCount(originalFqn, reference);
}
- private int decrementRefCount(Fqn<?> originalFqn, Fqn<?> referencingFqn) throws CacheException
+ private int decrementRefCount(Fqn<?> originalFqn, Reference reference) throws CacheException
{
- return internal_.decrementRefCount(originalFqn, referencingFqn);
+ return internal_.decrementRefCount(originalFqn, reference);
}
}
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheDelegate.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -20,6 +20,7 @@
import org.jboss.cache.Node;
import org.jboss.cache.Region;
import org.jboss.cache.pojo.PojoCacheException;
+import org.jboss.cache.pojo.Reference;
import org.jboss.cache.pojo.collection.CollectionInterceptorUtil;
import org.jboss.cache.pojo.interceptors.dynamic.AbstractCollectionInterceptor;
import org.jboss.cache.pojo.interceptors.dynamic.BaseInterceptor;
@@ -27,12 +28,7 @@
import org.jboss.cache.pojo.util.AopUtil;
import java.lang.reflect.Field;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
/**
* Delegate class for PojoCache, the real implementation code happens here.
@@ -126,9 +122,10 @@
AbstractHandler handler = getHandler(obj.getClass(), allowArray);
Fqn<?> internalFqn = handler.getFqn(obj);
+ Reference reference = new ReferenceImpl(fqn, field);
if (internalFqn != null)
{
- graphHandler_.put(internalFqn, fqn, obj);
+ graphHandler_.put(internalFqn, reference , obj);
}
else
{
@@ -136,7 +133,7 @@
if (log.isDebugEnabled())
log.debug("attach(): id: " + fqn + " will store the pojo in the internal area: " + internalFqn);
- handler.put(internalFqn, fqn, obj);
+ handler.put(internalFqn, reference, obj);
// Used by notification sub-system
cache.put(internalFqn, InternalConstant.POJOCACHE_STATUS, "ATTACHED");
@@ -245,15 +242,16 @@
if (result == null)
return null;
+ Reference reference = new ReferenceImpl(fqn, field);
if (graphHandler_.isMultipleReferenced(internalFqn))
{
- graphHandler_.remove(internalFqn, fqn, result);
+ graphHandler_.remove(internalFqn, reference, result);
}
else
{
cache.put(internalFqn, InternalConstant.POJOCACHE_STATUS, "DETACHING");
boolean allowArray = source instanceof ArrayInterceptable;
- result = getHandler(result.getClass(), allowArray).remove(internalFqn, fqn, result);
+ result = getHandler(result.getClass(), allowArray).remove(internalFqn, reference, result);
}
internal_.cleanUp(fqn, field);
@@ -346,4 +344,21 @@
{
return internal_.getPojoReference(id, null) != null || internal_.getPojoInstance(id) != null;
}
+
+ public Fqn<?> getInternalFqn(Object object)
+ {
+ AbstractHandler handler = getHandler(object.getClass(), true);
+ Fqn<?> internalFqn = handler.getFqn(object);
+ return internalFqn;
+ }
+
+ public Collection<Reference> getReferences(Object object)
+ {
+ Fqn<?> fqn = getInternalFqn(object);
+ if (fqn == null)
+ return Collections.emptyList();
+
+ PojoInstance pojoInstance = internal_.getPojoInstance(fqn);
+ return pojoInstance.getReferences();
+ }
}
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheImpl.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheImpl.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoCacheImpl.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -8,6 +8,7 @@
package org.jboss.cache.pojo.impl;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.regex.Pattern;
@@ -29,6 +30,7 @@
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheException;
import org.jboss.cache.pojo.PojoCacheThreadContext;
+import org.jboss.cache.pojo.Reference;
import org.jboss.cache.pojo.interceptors.PojoTxSynchronizationHandler;
import org.jboss.cache.transaction.BatchModeTransactionManager;
@@ -225,11 +227,16 @@
return detach(id, null, null);
}
- public String getPojoID(Object pojo)
+ public Fqn<?> getInternalFqn(Object object)
{
- throw new PojoCacheException("getPojoID not yet implemented");
+ return delegate_.getInternalFqn(object);
}
+ public Collection<Reference> getReferences(Object object)
+ {
+ return delegate_.getReferences(object);
+ }
+
public boolean exists(Fqn<?> id)
{
return delegate_.exists(id);
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoInstance.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoInstance.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoInstance.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -7,11 +7,10 @@
package org.jboss.cache.pojo.impl;
import org.jboss.cache.Fqn;
+import org.jboss.cache.pojo.Reference;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
/**
* POJO class metadata information.
@@ -35,17 +34,13 @@
// The instance is transient to avoid replication outside the VM
private transient Object instance_;
- // If not null, it signifies that this is a reference that points to this fqn.
- // Note that this will get replicated.
- private String internalFqn_ = null;
-
// Reference counting. THis will get replicated as well. This keep track of number of
// other instances that referenced this fqn.
private int refCount_ = INITIAL_COUNTER_VALUE;
- // List of fqns that reference this fqn. Assume list size is not big since it may not be efficient.
- private List<Fqn> referencedBy_ = null;
- private Class clazz_ = null;
+ // List of fqns that reference this fqn.
+ private Set<Reference> referencedBy_ = new HashSet<Reference>(4);
+ private Class<?> clazz_ = null;
private transient PojoUtil util_ = new PojoUtil();
public PojoInstance()
@@ -77,59 +72,31 @@
instance_ = instance;
}
- public String getInternalFqn()
+ synchronized public int incrementRefCount(Reference reference)
{
- return internalFqn_;
- }
-
- public void setInternalFqn(String refFqn)
- {
- internalFqn_ = refFqn;
- }
-
- public void removeInternalFqn()
- {
- internalFqn_ = null;
- }
-
- synchronized public int incrementRefCount(Fqn sourceFqn)
- {
- if (sourceFqn == null)
+ if (reference == null || reference.getFqn() == null)
{
throw new IllegalStateException("PojoInstance.incrementRefCount(): null sourceFqn");
}
- if (referencedBy_ == null)
- {
- referencedBy_ = new ArrayList();
- }
-
if (util_ == null) util_ = new PojoUtil();
- refCount_ = util_.incrementReferenceCount(sourceFqn, refCount_, referencedBy_);
-// referencedBy_.add(sourceFqn);
-
-// refCount_ += 1;
-//logger_.info("incrementRefCount(): current ref count " +refCount_);
+ refCount_ = util_.incrementReferenceCount(reference, refCount_, referencedBy_);
return refCount_;
}
- synchronized public int decrementRefCount(Fqn sourceFqn)
+ synchronized public int decrementRefCount(Reference reference)
{
- if (sourceFqn == null)
+ if (reference == null || reference.getFqn() == null)
{
throw new IllegalStateException("PojoInstance.incrementRefCount(): null sourceFqn");
}
- if (!referencedBy_.contains(sourceFqn))
- throw new IllegalStateException("PojoReference.decrementRefCount(): source fqn: " +
- sourceFqn + " is not present.");
+ if (!referencedBy_.contains(reference))
+ throw new IllegalStateException("PojoReference.decrementRefCount(): reference: " +
+ reference + " is not present.");
if (util_ == null) util_ = new PojoUtil();
- refCount_ = util_.decrementReferenceCount(sourceFqn, refCount_, referencedBy_);
-// referencedBy_.remove(sourceFqn);
-
-// refCount_ -= 1;
-//logger_.info("decrementRefCount(): current ref count " +refCount_);
+ refCount_ = util_.decrementReferenceCount(reference, refCount_, referencedBy_);
return refCount_;
}
@@ -138,23 +105,13 @@
return refCount_;
}
- public List<Fqn> getReferences()
+ public Collection<Reference> getReferences()
{
- return Collections.unmodifiableList(referencedBy_);
+ return Collections.unmodifiableCollection(referencedBy_);
}
- synchronized public Fqn getAndRemoveFirstFqnInList()
- {
- return (Fqn) referencedBy_.remove(0);
- }
-
- synchronized public void addXFqnIntoList(Fqn fqn)
- {
- referencedBy_.add(0, fqn);
- }
-
public String toString()
{
- return "PI[fqn=" + internalFqn_ + " ref=" + refCount_ + " class=" + clazz_.getName() + "]";
+ return "PI[ref=" + refCount_ + " class=" + clazz_.getName() + "]";
}
}
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoUtil.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoUtil.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/PojoUtil.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -10,11 +10,13 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
+import java.util.Set;
import org.jboss.aop.InstanceAdvisor;
import org.jboss.aop.advice.Interceptor;
import org.jboss.cache.Fqn;
import org.jboss.cache.pojo.PojoCacheException;
+import org.jboss.cache.pojo.Reference;
import org.jboss.cache.pojo.collection.CachedArray;
import org.jboss.cache.pojo.collection.CachedArrayRegistry;
import org.jboss.cache.pojo.interceptors.PojoTxSynchronizationHandler;
@@ -157,45 +159,45 @@
}
}
- public int incrementReferenceCount(Fqn<?> sourceFqn, int count, List<?> refList)
+ public int incrementReferenceCount(Reference reference, int count, Set<Reference> referencedBy_)
{
- int ret = _incrementReferenceCount(sourceFqn, count, refList);
+ int ret = _incrementReferenceCount(reference, count, referencedBy_);
Method method = MethodDeclarations.undoIncrementReferenceCount;
- Object[] args = new Object[]{sourceFqn, count, refList};
+ Object[] args = new Object[]{reference, count, referencedBy_};
MethodCall mc = new MethodCall(method, args, this);
addUndo(mc);
return ret;
}
- public int undoIncrementReferenceCount(Fqn sourceFqn, int count, List refList)
+ public int undoIncrementReferenceCount(Reference reference, int count, Set<Reference> refList)
{
- return _decrementReferenceCount(sourceFqn, count, refList);
+ return _decrementReferenceCount(reference, count, refList);
}
- private int _incrementReferenceCount(Fqn sourceFqn, int count, List refList)
+ private int _incrementReferenceCount(Reference reference, int count, Set<Reference> referencedBy_)
{
- refList.add(sourceFqn);
+ referencedBy_.add(reference);
return count + 1;
}
- public int decrementReferenceCount(Fqn<?> sourceFqn, int count, List<?> refList)
+ public int decrementReferenceCount(Reference reference, int count, Set<Reference> referencedBy_)
{
- int ret = _decrementReferenceCount(sourceFqn, count, refList);
+ int ret = _decrementReferenceCount(reference, count, referencedBy_);
Method method = MethodDeclarations.undoDecrementReferenceCount;
- Object[] args = new Object[]{sourceFqn, count, refList};
+ Object[] args = new Object[]{reference, count, referencedBy_};
MethodCall mc = new MethodCall(method, args, this);
addUndo(mc);
return ret;
}
- public int undoDecrementReferenceCount(Fqn sourceFqn, int count, List refList)
+ public int undoDecrementReferenceCount(Reference reference, int count, Set<Reference> refList)
{
- return _incrementReferenceCount(sourceFqn, count, refList);
+ return _incrementReferenceCount(reference, count, refList);
}
- private int _decrementReferenceCount(Fqn sourceFqn, int count, List refList)
+ private int _decrementReferenceCount(Reference reference, int count, Set<Reference> referencedBy_)
{
- refList.remove(sourceFqn);
+ referencedBy_.remove(reference);
return count - 1;
}
}
Added: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ReferenceImpl.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ReferenceImpl.java (rev 0)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/ReferenceImpl.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.cache.pojo.impl;
+
+import java.io.Serializable;
+
+import net.jcip.annotations.Immutable;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.pojo.Reference;
+
+/**
+ * A reference from an attached object to another attached object. This class also contains the name
+ * of the field that contains the reference.
+ *
+ * @author Dan Berindei <dan.berindei(a)gmail.com>
+ */
+@Immutable
+public final class ReferenceImpl implements Reference, Serializable
+{
+ private static final long serialVersionUID = 2647262858847953704L;
+
+ private Fqn<?> fqn;
+ private String key;
+
+ public ReferenceImpl(Fqn<?> fqn)
+ {
+ this(fqn, null);
+ }
+
+ /**
+ * @param fqn <code>Fqn</code> of the referring node. Cannot be <code>null</code>.
+ * @param key Name of the field, index in the field or key in the collection that is containing the reference.
+ */
+ public ReferenceImpl(Fqn<?> fqn, String key)
+ {
+ if (fqn == null)
+ throw new IllegalArgumentException("Fqn can not be null!!");
+
+ this.fqn = fqn;
+ this.key = key;
+ }
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public Fqn<?> getFqn()
+ {
+ return fqn;
+ }
+
+ private boolean equals(Object o1, Object o2)
+ {
+ if (o1 == o2)
+ return true;
+
+ if (o1 != null && o1.equals(o2))
+ return true;
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = 629 * fqn.hashCode();
+
+ if (key != null)
+ result = 37 * result + key.hashCode();
+
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (o instanceof Reference)
+ return equals(((ReferenceImpl) o).fqn, fqn) && equals(((ReferenceImpl) o).key, key);
+
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Reference[fqn=" + fqn + " field=" + key + "]";
+ }
+}
\ No newline at end of file
Deleted: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/Referrer.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/Referrer.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/Referrer.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -1,89 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.cache.pojo.impl;
-
-import org.jboss.cache.Fqn;
-
-/**
- * A referrer node refers to an internal node.
- *
- * @author Jason T. Greene
- */
-final class Referrer
-{
- private Fqn fqn;
- private String field;
-
- Referrer(Fqn fqn)
- {
- this(fqn, null);
- }
-
- Referrer(Fqn fqn, String field)
- {
- if (fqn == null)
- throw new IllegalArgumentException("Fqn can not be null!!");
-
- this.fqn = fqn;
- this.field = field;
- }
-
- public String getField()
- {
- return field;
- }
-
- public Fqn getFqn()
- {
- return fqn;
- }
-
- private boolean equals(Object o1, Object o2)
- {
- if (o1 == o2)
- return true;
-
- if (o1 != null && o1.equals(o2))
- return true;
-
- return false;
- }
-
- public int hashCode()
- {
- int result = 629 * fqn.hashCode();
-
- if (field != null)
- result = 37 * result + field.hashCode();
-
- return result;
- }
-
- public boolean equals(Object o)
- {
- if (o instanceof Referrer)
- return equals(((Referrer)o).fqn, fqn) && equals(((Referrer)o).field, field);
-
- return false;
- }
-}
\ No newline at end of file
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/SerializableObjectHandler.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/SerializableObjectHandler.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/impl/SerializableObjectHandler.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -15,8 +15,8 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
+import org.jboss.cache.pojo.Reference;
/**
* Handle Serializable object cache management.
@@ -37,13 +37,13 @@
this.cache = pojoCache.getCache();
internal_ = internal;
}
-
+
protected Fqn<?> getFqn(Object obj)
{
// Not supported
return null;
}
-
+
@Override
protected boolean handles(Class<?> clazz)
{
@@ -59,7 +59,7 @@
@Override
- protected void put(Fqn<?> fqn, Fqn<?> referencingFqn, Object obj) throws CacheException
+ protected void put(Fqn<?> fqn, Reference reference, Object obj) throws CacheException
{
// Note that JBoss Serialization can serialize any type now.
if (log_.isDebugEnabled())
@@ -87,7 +87,7 @@
}
@Override
- protected Object remove(Fqn<?> fqn, Fqn<?> referenceingFqn, Object result) throws CacheException
+ protected Object remove(Fqn<?> fqn, Reference reference, Object result) throws CacheException
{
cache.removeNode(fqn);
return result;
Modified: pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java
===================================================================
--- pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java 2008-07-23 01:33:57 UTC (rev 6373)
+++ pojo/trunk/src/main/java/org/jboss/cache/pojo/jmx/PojoCacheJmxWrapper.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -123,7 +123,7 @@
public String getInternalLocation(Object pojo) throws PojoCacheAlreadyDetachedException
{
- return pojoCache.getPojoID(pojo);
+ return pojoCache.getInternalFqn(pojo).toString();
}
public String getUnderlyingCacheObjectName()
Added: pojo/trunk/src/test/java/org/jboss/cache/pojo/FindReferencesTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/FindReferencesTest.java (rev 0)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/FindReferencesTest.java 2008-07-23 05:01:02 UTC (rev 6374)
@@ -0,0 +1,155 @@
+package org.jboss.cache.pojo;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.util.*;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.pojo.impl.ReferenceImpl;
+import org.jboss.cache.pojo.test.*;
+import org.testng.annotations.*;
+
+/**
+ * Test case for finding back-references.
+ *
+ * @author Dan Berindei <dan.berindei(a)gmail.com>
+ */
+
+@Test(groups = { "functional" })
+public class FindReferencesTest
+{
+ Log log = LogFactory.getLog(FindReferencesTest.class);
+ PojoCache cache_;
+
+ @BeforeMethod(alwaysRun = true)
+ protected void setUp() throws Exception
+ {
+ log.info("setUp() ....");
+ String configFile = "META-INF/local-service.xml";
+ boolean toStart = false;
+ cache_ = PojoCacheFactory.createCache(configFile, toStart);
+ cache_.start();
+ }
+
+ @AfterMethod(alwaysRun = true)
+ protected void tearDown() throws Exception
+ {
+ cache_.stop();
+ }
+
+ private Person createPerson(String id, String name, int age, Address address)
+ {
+ Person p = new Person(null);
+ p.setName(name);
+ p.setAge(age);
+ p.setAddress(address);
+ cache_.attach(id, p);
+ return p;
+ }
+
+ private Address createAddress()
+ {
+ Address add = new Address();
+ add.setZip(95123);
+ add.setCity("San Jose");
+ return add;
+ }
+
+ public void testImmediateType() throws Exception
+ {
+ log.info("testImmediateType() ....");
+ String test = "This is a test";
+ cache_.attach("/test", test);
+
+ assertEquals("Fqn", null, cache_.getInternalFqn(test));
+ assertEquals("List", Collections.EMPTY_LIST, cache_.getReferences(test));
+ }
+
+ public void testNotAttached() throws Exception
+ {
+ log.info("testImmediateType() ....");
+ Address address = createAddress();
+
+ assertEquals("Fqn", null, cache_.getInternalFqn(address));
+ assertEquals("List", Collections.EMPTY_LIST, cache_.getReferences(address));
+ }
+
+ public void testSingleExternalReference() throws Exception
+ {
+ log.info("testNoReferences() ....");
+ Person joe = createPerson("/person/joe", "Joe Black", 32, null);
+
+ Fqn<?> joesInternalFqn = cache_.getInternalFqn(joe);
+ assertTrue("Internal Fqn not null", joesInternalFqn != null);
+
+ Collection<Reference> addressReferences = cache_.getReferences(joe);
+ assertEquals("Size", 1, addressReferences.size());
+ assertEquals("Reference", new ReferenceImpl(Fqn.fromString("/person/joe"), null),
+ addressReferences.iterator().next());
+ }
+
+ public void testSingleInternalReference() throws Exception
+ {
+ log.info("testSingleReference() ....");
+ Address address = createAddress();
+ Person joe = createPerson("/person/joe", "Joe Black", 32, address);
+
+ Fqn<?> joesInternalFqn = cache_.getInternalFqn(joe);
+ Collection<Reference> addressReferences = cache_.getReferences(address);
+
+ assertEquals("Size", 1, addressReferences.size());
+ assertEquals("Reference", new ReferenceImpl(joesInternalFqn, "address"),
+ addressReferences.iterator().next());
+ }
+
+ public void testMultipleInternalReferences() throws Exception
+ {
+ log.info("testMultipleReferences() ....");
+ Address address = createAddress();
+ Person joe = createPerson("/person/joe", "Joe Black", 32, address);
+ Person jane = createPerson("/person/jane", "Jane Black", 32, address);
+
+ Fqn<?> joesInternalFqn = cache_.getInternalFqn(joe);
+ Fqn<?> janesInternalFqn = cache_.getInternalFqn(jane);
+ HashSet<Reference> expectedReferences = new HashSet<Reference>(Arrays.<Reference> asList(
+ new ReferenceImpl(joesInternalFqn, "address"), new ReferenceImpl(janesInternalFqn, "address")));
+
+ Set<Reference> addressReferences = new HashSet<Reference>(cache_.getReferences(address));
+
+ assertEquals("Reference Fqns", expectedReferences, addressReferences);
+ }
+
+ public void testDoubleReferenceFromSameObject()
+ {
+ log.info("testDoubleReferenceFromSameObject() ...");
+
+ DoubleRef doubleRef = new DoubleRef();
+ cache_.attach("/doubleref", doubleRef);
+
+ Fqn<?> sourceFqn = cache_.getInternalFqn(doubleRef);
+ HashSet<Reference> expectedReferences = new HashSet<Reference>(Arrays.<Reference> asList(
+ new ReferenceImpl(sourceFqn, "one"), new ReferenceImpl(sourceFqn, "two")));
+
+ Student student = doubleRef.getOne();
+ Set<Reference> references = new HashSet<Reference>(cache_.getReferences(student));
+
+ assertEquals("Reference Fqns", expectedReferences, references);
+
+ // removing one of the references
+ doubleRef.setOne(null);
+ Collection<Reference> references2 = cache_.getReferences(student);
+
+ assertEquals("Size", 1, references2.size());
+ assertEquals("Reference Fqn", new ReferenceImpl(sourceFqn, "two"), references2.iterator().next());
+
+ // removing the last reference
+ doubleRef.setTwo(null);
+ Collection<Reference> references3 = cache_.getReferences(student);
+
+ assertEquals("Size", 0, references3.size());
+ }
+
+}
\ No newline at end of file
15 years, 10 months
JBoss Cache SVN: r6373 - benchmarks/benchmark-fwk/trunk/conf.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-22 21:33:57 -0400 (Tue, 22 Jul 2008)
New Revision: 6373
Modified:
benchmarks/benchmark-fwk/trunk/conf/cachebench-local.xml
Log:
Longer warmup
Modified: benchmarks/benchmark-fwk/trunk/conf/cachebench-local.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/conf/cachebench-local.xml 2008-07-23 01:32:31 UTC (rev 6372)
+++ benchmarks/benchmark-fwk/trunk/conf/cachebench-local.xml 2008-07-23 01:33:57 UTC (rev 6373)
@@ -44,7 +44,7 @@
If no warmup is needed use org.cachebench.warmup.NoCacheWarmup
-->
<warmup warmupClass="org.cachebench.warmup.PutGetCacheWarmup">
- <param name="operationCount" value="10000"/>
+ <param name="operationCount" value="50000"/>
</warmup>
<!--
15 years, 10 months
JBoss Cache SVN: r6372 - in benchmarks/benchmark-fwk/trunk/cache-products: ehcache-1.5.0 and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-22 21:32:31 -0400 (Tue, 22 Jul 2008)
New Revision: 6372
Added:
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-local.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-async.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-sync.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/config.sh
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/lib/ehcache.jar
Removed:
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-local.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-async.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-sync.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/config.sh
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/lib/ehcache.jar
Log:
Copied: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0 (from rev 6312, benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1)
Deleted: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-local.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-local.xml 2008-07-17 10:56:16 UTC (rev 6312)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-local.xml 2008-07-23 01:32:31 UTC (rev 6372)
@@ -1,325 +0,0 @@
-<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
-
- <!--
- DiskStore configuration
-
- Sets the path to the directory where cache files are created.
-
- If the path is a Java System Property it is replaced by its value in the
- running VM.
-
- The following properties are translated:
- * user.home - User's home directory
- * user.dir - User's current working directory
- * java.io.tmpdir - Default temp file path
-
- Subdirectories can be specified below the property e.g. java.io.tmpdir/one
- -->
- <diskStore path="java.io.tmpdir"/>
-
- <!--
- Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
- which is notified when Caches are added or removed from the CacheManager.
-
- The attributes of CacheManagerEventListenerFactory are:
- * class - a fully qualified factory class name
- * properties - comma separated properties having meaning only to the factory.
-
- Sets the fully qualified class name to be registered as the CacheManager event listener.
-
- The events include:
- * adding a Cache
- * removing a Cache
-
- Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
- of the implementer to safely handle the potential performance and thread safety issues
- depending on what their listener is doing.
-
- If no class is specified, no listener is created. There is no default.
- -->
- <cacheManagerEventListenerFactory class="" properties=""/>
-
-
- <!--
- (Enable for distributed operation)
-
- Specifies a CacheManagerPeerProviderFactory which will be used to create a
- CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
-
- The attributes of cacheManagerPeerProviderFactory are:
- * class - a fully qualified factory class name
- * properties - comma separated properties having meaning only to the factory.
-
- Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
- CacheManager peers participating in the cluster:
- * automatic, using a multicast group. This one automatically discovers peers and detects
- changes such as peers entering and leaving the group
- * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
- configuration time.
-
- Configuring Automatic Discovery:
- Automatic discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
- multicastGroupPort=4446, timeToLive=32"/>
-
- Valid properties are:
- * peerDiscovery (mandatory) - specify "automatic"
- * multicastGroupAddress (mandatory) - specify a valid multicast group address
- * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
- traffic
- * timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate.
- By convention, the restrictions are:
- 0 - the same host
- 1 - the same subnet
- 32 - the same site
- 64 - the same region
- 128 - the same continent
- 255 - unrestricted
-
- Configuring Manual Discovery:
- Manual discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory class=
- "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=manual,
- rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
- | //server1:40000/sampleCache2|//server2:40000/sampleCache2"/>
-
- Valid properties are:
- * peerDiscovery (mandatory) - specify "manual"
- * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
- //hostname:port
-
- The hostname is the hostname of the remote CacheManager peer. The port is the listening
- port of the RMICacheManagerPeerListener of the remote CacheManager peer.
-
- An alternate CacheManagerPeerProviderFactory can be used for JNDI discovery of other
- CacheManagers in the cluster. Only manual discovery is supported.
-
- For cacheManagerPeerProviderFactory specify class
- net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
-
- Correspondingly for cacheManagerPeerListenerFactory specify class
- net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactoryory.
-
- Configuring JNDI Manual Discovery:
- Manual JNDI discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory class=
- "net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory"
- properties="peerDiscovery=manual, stashContexts=true, stashRemoteCachePeers=true,
- jndiUrls=t3//server1:40000/sampleCache1|t3//server2:40000/sampleCache1
- |t3//server1:40000/sampleCache2|t3//server2:40000/sampleCache2"/>
-
- Valid properties are:
- * peerDiscovery (mandatory) - specify "manual"
- * stashContexts (optional) - specify "true" or "false". Defaults to true.
- java.naming.Context objects are stashed for performance.
- * stashRemoteCachePeers (optional) - specify "true" or "false". Defaults to true.
- CachePeer objects are stashed for performance.
- * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls,
- in the form protocol//hostname:port
- -->
- <cacheManagerPeerProviderFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=automatic,
- multicastGroupAddress=228.1.2.3,
- multicastGroupPort=48866, timeToLive=64"/>
-
-
- <!--
- (Enable for distributed operation)
-
- Specifies a CacheManagerPeerListenerFactory which will be used to create a
- CacheManagerPeerListener, which
- listens for messages from cache replicators participating in the cluster.
-
- The attributes of cacheManagerPeerListenerFactory are:
- class - a fully qualified factory class name
- properties - comma separated properties having meaning only to the factory.
-
- Ehcache comes with a built-in RMI-based distribution system. The listener component is
- RMICacheManagerPeerListener which is configured using
- RMICacheManagerPeerListenerFactory. It is configured as per the following example:
-
- <cacheManagerPeerListenerFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
- properties="hostName=fully_qualified_hostname_or_ip,
- port=40001,
- socketTimeoutMillis=120000"/>
-
- All properties are optional. They are:
- * hostName - the hostName of the host the listener is running on. Specify
- where the host is multihomed and you want to control the interface over which cluster
- messages are received. Defaults to the host name of the default interface if not
- specified.
- * port - the port the listener listens on. This defaults to a free port if not specified.
- * socketTimeoutMillis - the number of ms client sockets will stay open when sending
- messages to the listener. This should be long enough for the slowest message.
- If not specified it defaults 120000ms.
-
-
- An alternate CacheManagerPeerListenerFactory can be also be used for JNDI binding of
- listeners for messages from cache replicators participating in the cluster. For
- cacheManagerPeerListenerFactory specify
- class net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactory.
- Correspondingly for cacheManagerPeerProviderFactory specify class
- net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
- Properties for JNDIRMICacheManagerPeerListenerFactory are the same as
- RMICacheManagerPeerListenerFactory.
-
- -->
- <cacheManagerPeerListenerFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
- properties="hostName=127.0.0.1, socketTimeoutMillis=120000"/>
-
-
- <!-- Cache configuration.
-
- The following attributes are required.
-
- name:
- Sets the name of the cache. This is used to identify the cache. It must be unique.
-
- maxElementsInMemory:
- Sets the maximum number of objects that will be created in memory
-
- maxElementsOnDisk:
- Sets the maximum number of objects that will be maintained in the DiskStore
- The default value is zero, meaning unlimited.
-
- eternal:
- Sets whether elements are eternal. If eternal, timeouts are ignored and the
- element is never expired.
-
- overflowToDisk:
- Sets whether elements can overflow to disk when the memory store
- has reached the maxInMemory limit.
-
- The following attributes are optional.
-
- timeToIdleSeconds:
- Sets the time to idle for an element before it expires.
- i.e. The maximum amount of time between accesses before an element expires
- Is only used if the element is not eternal.
- Optional attribute. A value of 0 means that an Element can idle for infinity.
- The default value is 0.
-
- timeToLiveSeconds:
- Sets the time to live for an element before it expires.
- i.e. The maximum time between creation time and when an element expires.
- Is only used if the element is not eternal.
- Optional attribute. A value of 0 means that and Element can live for infinity.
- The default value is 0.
-
- diskPersistent:
- Whether the disk store persists between restarts of the Virtual Machine.
- The default value is false.
-
- diskExpiryThreadIntervalSeconds:
- The number of seconds between runs of the disk expiry thread. The default value
- is 120 seconds.
-
- memoryStoreEvictionPolicy:
- Policy would be enforced upon reaching the maxElementsInMemory limit. Default
- policy is Least Recently Used (specified as LRU). Other policies available -
- First In First Out (specified as FIFO) and Less Frequently Used
- (specified as LFU)
-
- Cache elements can also contain sub elements which take the same format of a factory class
- and properties. Defined sub-elements are:
-
- * cacheEventListenerFactory - Enables registration of listeners for cache events, such as
- put, remove, update, and expire.
-
- * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
- cache on initialisation to prepopulate itself.
-
- Each cache that will be distributed needs to set a cache event listener which replicates
- messages to the other CacheManager peers. For the built-in RMI implementation this is done
- by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
- distributed cache's configuration as per the following example:
-
- <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
- properties="replicateAsynchronously=true,
- replicatePuts=true,
- replicateUpdates=true,
- replicateUpdatesViaCopy=true,
- replicateRemovals=true "/>
-
- The RMICacheReplicatorFactory recognises the following properties:
-
- * replicatePuts=true|false - whether new elements placed in a cache are
- replicated to others. Defaults to true.
-
- * replicateUpdates=true|false - whether new elements which override an
- element already existing with the same key are replicated. Defaults to true.
-
- * replicateRemovals=true - whether element removals are replicated. Defaults to true.
-
- * replicateAsynchronously=true | false - whether replications are
- asynchronous (true) or synchronous (false). Defaults to true.
-
- * replicateUpdatesViaCopy=true | false - whether the new elements are
- copied to other caches (true), or whether a remove message is sent. Defaults to true.
-
- * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
- replicator runs at a set interval of milliseconds. The default is 1000. The minimum
- is 10. This property is only applicable if replicateAsynchronously=true
-
- The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
- used. It is configured as per the following example:
-
- <bootstrapCacheLoaderFactory
- class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
- properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>
-
- The RMIBootstrapCacheLoaderFactory recognises the following optional properties:
-
- * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
- after the cache has started. If false, bootstrapping must complete before the cache is
- made available. The default value is true.
-
- * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
- memory limits of the VM. This property allows the bootstraper to fetched elements in
- chunks. The default chunk size is 5000000 (5MB).
-
- -->
-
- <!--
- Mandatory Default Cache configuration. These settings will be applied to caches
- created programmtically using CacheManager.add(String cacheName)
- -->
- <defaultCache
- maxElementsInMemory="10000"
- eternal="false"
- timeToIdleSeconds="120"
- timeToLiveSeconds="120"
- overflowToDisk="false"
- maxElementsOnDisk="10000000"
- diskPersistent="false"
- diskExpiryThreadIntervalSeconds="120"
- memoryStoreEvictionPolicy="LRU"
- />
-
- <!--
- Sample caches. Following are some example caches. Remove these before use.
- -->
-
- <!--
- NOTE that the cache benchmarking fwk looks for a cache named "cache".
- -->
-
- <!--
- Sample distributed cache named sampleDistributedCache2.
- This cache replicates using specific properties.
- It only replicates updates and does so synchronously via copy
- -->
- <cache name="cache"
- maxElementsInMemory="10000"
- eternal="false"
- timeToIdleSeconds="100"
- timeToLiveSeconds="100"
- overflowToDisk="false">
- </cache>
-</ehcache>
Copied: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-local.xml (from rev 6370, benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-local.xml)
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-local.xml (rev 0)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-local.xml 2008-07-23 01:32:31 UTC (rev 6372)
@@ -0,0 +1,329 @@
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
+
+ <!--
+ DiskStore configuration
+
+ Sets the path to the directory where cache files are created.
+
+ If the path is a Java System Property it is replaced by its value in the
+ running VM.
+
+ The following properties are translated:
+ * user.home - User's home directory
+ * user.dir - User's current working directory
+ * java.io.tmpdir - Default temp file path
+
+ Subdirectories can be specified below the property e.g. java.io.tmpdir/one
+ -->
+ <diskStore path="java.io.tmpdir"/>
+
+ <!--
+ Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
+ which is notified when Caches are added or removed from the CacheManager.
+
+ The attributes of CacheManagerEventListenerFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the factory.
+
+ Sets the fully qualified class name to be registered as the CacheManager event listener.
+
+ The events include:
+ * adding a Cache
+ * removing a Cache
+
+ Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
+ of the implementer to safely handle the potential performance and thread safety issues
+ depending on what their listener is doing.
+
+ If no class is specified, no listener is created. There is no default.
+ -->
+ <cacheManagerEventListenerFactory class="" properties=""/>
+
+
+ <!--
+ (Enable for distributed operation)
+
+ Specifies a CacheManagerPeerProviderFactory which will be used to create a
+ CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
+
+ The attributes of cacheManagerPeerProviderFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the factory.
+
+ Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
+ CacheManager peers participating in the cluster:
+ * automatic, using a multicast group. This one automatically discovers peers and detects
+ changes such as peers entering and leaving the group
+ * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
+ configuration time.
+
+ Configuring Automatic Discovery:
+ Automatic discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
+ multicastGroupPort=4446, timeToLive=32"/>
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "automatic"
+ * multicastGroupAddress (mandatory) - specify a valid multicast group address
+ * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
+ traffic
+ * timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate.
+ By convention, the restrictions are:
+ 0 - the same host
+ 1 - the same subnet
+ 32 - the same site
+ 64 - the same region
+ 128 - the same continent
+ 255 - unrestricted
+
+ Configuring Manual Discovery:
+ Manual discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=manual,
+ rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
+ | //server1:40000/sampleCache2|//server2:40000/sampleCache2"/>
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "manual"
+ * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
+ //hostname:port
+
+ The hostname is the hostname of the remote CacheManager peer. The port is the listening
+ port of the RMICacheManagerPeerListener of the remote CacheManager peer.
+
+ An alternate CacheManagerPeerProviderFactory can be used for JNDI discovery of other
+ CacheManagers in the cluster. Only manual discovery is supported.
+
+ For cacheManagerPeerProviderFactory specify class
+ net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
+
+ Correspondingly for cacheManagerPeerListenerFactory specify class
+ net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactoryory.
+
+ Configuring JNDI Manual Discovery:
+ Manual JNDI discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory"
+ properties="peerDiscovery=manual, stashContexts=true, stashRemoteCachePeers=true,
+ jndiUrls=t3//server1:40000/sampleCache1|t3//server2:40000/sampleCache1
+ |t3//server1:40000/sampleCache2|t3//server2:40000/sampleCache2"/>
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "manual"
+ * stashContexts (optional) - specify "true" or "false". Defaults to true.
+ java.naming.Context objects are stashed for performance.
+ * stashRemoteCachePeers (optional) - specify "true" or "false". Defaults to true.
+ CachePeer objects are stashed for performance.
+ * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls,
+ in the form protocol//hostname:port
+ -->
+ <!--
+ <cacheManagerPeerProviderFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=automatic,
+ multicastGroupAddress=228.1.2.3,
+ multicastGroupPort=48866, timeToLive=64"/>
+ -->
+
+
+ <!--
+ (Enable for distributed operation)
+
+ Specifies a CacheManagerPeerListenerFactory which will be used to create a
+ CacheManagerPeerListener, which
+ listens for messages from cache replicators participating in the cluster.
+
+ The attributes of cacheManagerPeerListenerFactory are:
+ class - a fully qualified factory class name
+ properties - comma separated properties having meaning only to the factory.
+
+ Ehcache comes with a built-in RMI-based distribution system. The listener component is
+ RMICacheManagerPeerListener which is configured using
+ RMICacheManagerPeerListenerFactory. It is configured as per the following example:
+
+ <cacheManagerPeerListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
+ properties="hostName=fully_qualified_hostname_or_ip,
+ port=40001,
+ socketTimeoutMillis=120000"/>
+
+ All properties are optional. They are:
+ * hostName - the hostName of the host the listener is running on. Specify
+ where the host is multihomed and you want to control the interface over which cluster
+ messages are received. Defaults to the host name of the default interface if not
+ specified.
+ * port - the port the listener listens on. This defaults to a free port if not specified.
+ * socketTimeoutMillis - the number of ms client sockets will stay open when sending
+ messages to the listener. This should be long enough for the slowest message.
+ If not specified it defaults 120000ms.
+
+
+ An alternate CacheManagerPeerListenerFactory can be also be used for JNDI binding of
+ listeners for messages from cache replicators participating in the cluster. For
+ cacheManagerPeerListenerFactory specify
+ class net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactory.
+ Correspondingly for cacheManagerPeerProviderFactory specify class
+ net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
+ Properties for JNDIRMICacheManagerPeerListenerFactory are the same as
+ RMICacheManagerPeerListenerFactory.
+
+ -->
+ <!--
+ <cacheManagerPeerListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
+ properties="hostName=127.0.0.1, socketTimeoutMillis=120000"/>
+ -->
+
+
+ <!-- Cache configuration.
+
+ The following attributes are required.
+
+ name:
+ Sets the name of the cache. This is used to identify the cache. It must be unique.
+
+ maxElementsInMemory:
+ Sets the maximum number of objects that will be created in memory
+
+ maxElementsOnDisk:
+ Sets the maximum number of objects that will be maintained in the DiskStore
+ The default value is zero, meaning unlimited.
+
+ eternal:
+ Sets whether elements are eternal. If eternal, timeouts are ignored and the
+ element is never expired.
+
+ overflowToDisk:
+ Sets whether elements can overflow to disk when the memory store
+ has reached the maxInMemory limit.
+
+ The following attributes are optional.
+
+ timeToIdleSeconds:
+ Sets the time to idle for an element before it expires.
+ i.e. The maximum amount of time between accesses before an element expires
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that an Element can idle for infinity.
+ The default value is 0.
+
+ timeToLiveSeconds:
+ Sets the time to live for an element before it expires.
+ i.e. The maximum time between creation time and when an element expires.
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that and Element can live for infinity.
+ The default value is 0.
+
+ diskPersistent:
+ Whether the disk store persists between restarts of the Virtual Machine.
+ The default value is false.
+
+ diskExpiryThreadIntervalSeconds:
+ The number of seconds between runs of the disk expiry thread. The default value
+ is 120 seconds.
+
+ memoryStoreEvictionPolicy:
+ Policy would be enforced upon reaching the maxElementsInMemory limit. Default
+ policy is Least Recently Used (specified as LRU). Other policies available -
+ First In First Out (specified as FIFO) and Less Frequently Used
+ (specified as LFU)
+
+ Cache elements can also contain sub elements which take the same format of a factory class
+ and properties. Defined sub-elements are:
+
+ * cacheEventListenerFactory - Enables registration of listeners for cache events, such as
+ put, remove, update, and expire.
+
+ * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
+ cache on initialisation to prepopulate itself.
+
+ Each cache that will be distributed needs to set a cache event listener which replicates
+ messages to the other CacheManager peers. For the built-in RMI implementation this is done
+ by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
+ distributed cache's configuration as per the following example:
+
+ <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=true,
+ replicatePuts=true,
+ replicateUpdates=true,
+ replicateUpdatesViaCopy=true,
+ replicateRemovals=true "/>
+
+ The RMICacheReplicatorFactory recognises the following properties:
+
+ * replicatePuts=true|false - whether new elements placed in a cache are
+ replicated to others. Defaults to true.
+
+ * replicateUpdates=true|false - whether new elements which override an
+ element already existing with the same key are replicated. Defaults to true.
+
+ * replicateRemovals=true - whether element removals are replicated. Defaults to true.
+
+ * replicateAsynchronously=true | false - whether replications are
+ asynchronous (true) or synchronous (false). Defaults to true.
+
+ * replicateUpdatesViaCopy=true | false - whether the new elements are
+ copied to other caches (true), or whether a remove message is sent. Defaults to true.
+
+ * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
+ replicator runs at a set interval of milliseconds. The default is 1000. The minimum
+ is 10. This property is only applicable if replicateAsynchronously=true
+
+ The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
+ used. It is configured as per the following example:
+
+ <bootstrapCacheLoaderFactory
+ class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
+ properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>
+
+ The RMIBootstrapCacheLoaderFactory recognises the following optional properties:
+
+ * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
+ after the cache has started. If false, bootstrapping must complete before the cache is
+ made available. The default value is true.
+
+ * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
+ memory limits of the VM. This property allows the bootstraper to fetched elements in
+ chunks. The default chunk size is 5000000 (5MB).
+
+ -->
+
+ <!--
+ Mandatory Default Cache configuration. These settings will be applied to caches
+ created programmtically using CacheManager.add(String cacheName)
+ -->
+ <defaultCache
+ maxElementsInMemory="1000000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="false"
+ maxElementsOnDisk="10000000"
+ diskPersistent="false"
+ diskExpiryThreadIntervalSeconds="120"
+ memoryStoreEvictionPolicy="LRU"
+ />
+
+ <!--
+ Sample caches. Following are some example caches. Remove these before use.
+ -->
+
+ <!--
+ NOTE that the cache benchmarking fwk looks for a cache named "cache".
+ -->
+
+ <!--
+ Sample distributed cache named sampleDistributedCache2.
+ This cache replicates using specific properties.
+ It only replicates updates and does so synchronously via copy
+ -->
+ <cache name="cache"
+ maxElementsInMemory="1000000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="false">
+ </cache>
+</ehcache>
Deleted: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-async.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-repl-async.xml 2008-07-17 10:56:16 UTC (rev 6312)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-async.xml 2008-07-23 01:32:31 UTC (rev 6372)
@@ -1,331 +0,0 @@
-<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
-
- <!--
- DiskStore configuration
-
- Sets the path to the directory where cache files are created.
-
- If the path is a Java System Property it is replaced by its value in the
- running VM.
-
- The following properties are translated:
- * user.home - User's home directory
- * user.dir - User's current working directory
- * java.io.tmpdir - Default temp file path
-
- Subdirectories can be specified below the property e.g. java.io.tmpdir/one
- -->
- <diskStore path="java.io.tmpdir"/>
-
- <!--
- Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
- which is notified when Caches are added or removed from the CacheManager.
-
- The attributes of CacheManagerEventListenerFactory are:
- * class - a fully qualified factory class name
- * properties - comma separated properties having meaning only to the factory.
-
- Sets the fully qualified class name to be registered as the CacheManager event listener.
-
- The events include:
- * adding a Cache
- * removing a Cache
-
- Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
- of the implementer to safely handle the potential performance and thread safety issues
- depending on what their listener is doing.
-
- If no class is specified, no listener is created. There is no default.
- -->
- <cacheManagerEventListenerFactory class="" properties=""/>
-
-
- <!--
- (Enable for distributed operation)
-
- Specifies a CacheManagerPeerProviderFactory which will be used to create a
- CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
-
- The attributes of cacheManagerPeerProviderFactory are:
- * class - a fully qualified factory class name
- * properties - comma separated properties having meaning only to the factory.
-
- Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
- CacheManager peers participating in the cluster:
- * automatic, using a multicast group. This one automatically discovers peers and detects
- changes such as peers entering and leaving the group
- * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
- configuration time.
-
- Configuring Automatic Discovery:
- Automatic discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
- multicastGroupPort=4446, timeToLive=32"/>
-
- Valid properties are:
- * peerDiscovery (mandatory) - specify "automatic"
- * multicastGroupAddress (mandatory) - specify a valid multicast group address
- * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
- traffic
- * timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate.
- By convention, the restrictions are:
- 0 - the same host
- 1 - the same subnet
- 32 - the same site
- 64 - the same region
- 128 - the same continent
- 255 - unrestricted
-
- Configuring Manual Discovery:
- Manual discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory class=
- "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=manual,
- rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
- | //server1:40000/sampleCache2|//server2:40000/sampleCache2"/>
-
- Valid properties are:
- * peerDiscovery (mandatory) - specify "manual"
- * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
- //hostname:port
-
- The hostname is the hostname of the remote CacheManager peer. The port is the listening
- port of the RMICacheManagerPeerListener of the remote CacheManager peer.
-
- An alternate CacheManagerPeerProviderFactory can be used for JNDI discovery of other
- CacheManagers in the cluster. Only manual discovery is supported.
-
- For cacheManagerPeerProviderFactory specify class
- net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
-
- Correspondingly for cacheManagerPeerListenerFactory specify class
- net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactoryory.
-
- Configuring JNDI Manual Discovery:
- Manual JNDI discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory class=
- "net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory"
- properties="peerDiscovery=manual, stashContexts=true, stashRemoteCachePeers=true,
- jndiUrls=t3//server1:40000/sampleCache1|t3//server2:40000/sampleCache1
- |t3//server1:40000/sampleCache2|t3//server2:40000/sampleCache2"/>
-
- Valid properties are:
- * peerDiscovery (mandatory) - specify "manual"
- * stashContexts (optional) - specify "true" or "false". Defaults to true.
- java.naming.Context objects are stashed for performance.
- * stashRemoteCachePeers (optional) - specify "true" or "false". Defaults to true.
- CachePeer objects are stashed for performance.
- * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls,
- in the form protocol//hostname:port
- -->
- <cacheManagerPeerProviderFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=automatic,
- multicastGroupAddress=228.1.2.3,
- multicastGroupPort=48866, timeToLive=64"/>
-
-
- <!--
- (Enable for distributed operation)
-
- Specifies a CacheManagerPeerListenerFactory which will be used to create a
- CacheManagerPeerListener, which
- listens for messages from cache replicators participating in the cluster.
-
- The attributes of cacheManagerPeerListenerFactory are:
- class - a fully qualified factory class name
- properties - comma separated properties having meaning only to the factory.
-
- Ehcache comes with a built-in RMI-based distribution system. The listener component is
- RMICacheManagerPeerListener which is configured using
- RMICacheManagerPeerListenerFactory. It is configured as per the following example:
-
- <cacheManagerPeerListenerFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
- properties="hostName=fully_qualified_hostname_or_ip,
- port=40001,
- socketTimeoutMillis=120000"/>
-
- All properties are optional. They are:
- * hostName - the hostName of the host the listener is running on. Specify
- where the host is multihomed and you want to control the interface over which cluster
- messages are received. Defaults to the host name of the default interface if not
- specified.
- * port - the port the listener listens on. This defaults to a free port if not specified.
- * socketTimeoutMillis - the number of ms client sockets will stay open when sending
- messages to the listener. This should be long enough for the slowest message.
- If not specified it defaults 120000ms.
-
-
- An alternate CacheManagerPeerListenerFactory can be also be used for JNDI binding of
- listeners for messages from cache replicators participating in the cluster. For
- cacheManagerPeerListenerFactory specify
- class net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactory.
- Correspondingly for cacheManagerPeerProviderFactory specify class
- net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
- Properties for JNDIRMICacheManagerPeerListenerFactory are the same as
- RMICacheManagerPeerListenerFactory.
-
- -->
- <cacheManagerPeerListenerFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
- properties="hostName=127.0.0.1, socketTimeoutMillis=120000"/>
-
-
- <!-- Cache configuration.
-
- The following attributes are required.
-
- name:
- Sets the name of the cache. This is used to identify the cache. It must be unique.
-
- maxElementsInMemory:
- Sets the maximum number of objects that will be created in memory
-
- maxElementsOnDisk:
- Sets the maximum number of objects that will be maintained in the DiskStore
- The default value is zero, meaning unlimited.
-
- eternal:
- Sets whether elements are eternal. If eternal, timeouts are ignored and the
- element is never expired.
-
- overflowToDisk:
- Sets whether elements can overflow to disk when the memory store
- has reached the maxInMemory limit.
-
- The following attributes are optional.
-
- timeToIdleSeconds:
- Sets the time to idle for an element before it expires.
- i.e. The maximum amount of time between accesses before an element expires
- Is only used if the element is not eternal.
- Optional attribute. A value of 0 means that an Element can idle for infinity.
- The default value is 0.
-
- timeToLiveSeconds:
- Sets the time to live for an element before it expires.
- i.e. The maximum time between creation time and when an element expires.
- Is only used if the element is not eternal.
- Optional attribute. A value of 0 means that and Element can live for infinity.
- The default value is 0.
-
- diskPersistent:
- Whether the disk store persists between restarts of the Virtual Machine.
- The default value is false.
-
- diskExpiryThreadIntervalSeconds:
- The number of seconds between runs of the disk expiry thread. The default value
- is 120 seconds.
-
- memoryStoreEvictionPolicy:
- Policy would be enforced upon reaching the maxElementsInMemory limit. Default
- policy is Least Recently Used (specified as LRU). Other policies available -
- First In First Out (specified as FIFO) and Less Frequently Used
- (specified as LFU)
-
- Cache elements can also contain sub elements which take the same format of a factory class
- and properties. Defined sub-elements are:
-
- * cacheEventListenerFactory - Enables registration of listeners for cache events, such as
- put, remove, update, and expire.
-
- * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
- cache on initialisation to prepopulate itself.
-
- Each cache that will be distributed needs to set a cache event listener which replicates
- messages to the other CacheManager peers. For the built-in RMI implementation this is done
- by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
- distributed cache's configuration as per the following example:
-
- <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
- properties="replicateAsynchronously=true,
- replicatePuts=true,
- replicateUpdates=true,
- replicateUpdatesViaCopy=true,
- replicateRemovals=true "/>
-
- The RMICacheReplicatorFactory recognises the following properties:
-
- * replicatePuts=true|false - whether new elements placed in a cache are
- replicated to others. Defaults to true.
-
- * replicateUpdates=true|false - whether new elements which override an
- element already existing with the same key are replicated. Defaults to true.
-
- * replicateRemovals=true - whether element removals are replicated. Defaults to true.
-
- * replicateAsynchronously=true | false - whether replications are
- asynchronous (true) or synchronous (false). Defaults to true.
-
- * replicateUpdatesViaCopy=true | false - whether the new elements are
- copied to other caches (true), or whether a remove message is sent. Defaults to true.
-
- * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
- replicator runs at a set interval of milliseconds. The default is 1000. The minimum
- is 10. This property is only applicable if replicateAsynchronously=true
-
- The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
- used. It is configured as per the following example:
-
- <bootstrapCacheLoaderFactory
- class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
- properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>
-
- The RMIBootstrapCacheLoaderFactory recognises the following optional properties:
-
- * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
- after the cache has started. If false, bootstrapping must complete before the cache is
- made available. The default value is true.
-
- * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
- memory limits of the VM. This property allows the bootstraper to fetched elements in
- chunks. The default chunk size is 5000000 (5MB).
-
- -->
-
- <!--
- Mandatory Default Cache configuration. These settings will be applied to caches
- created programmtically using CacheManager.add(String cacheName)
- -->
- <defaultCache
- maxElementsInMemory="10000"
- eternal="false"
- timeToIdleSeconds="120"
- timeToLiveSeconds="120"
- overflowToDisk="true"
- maxElementsOnDisk="10000000"
- diskPersistent="false"
- diskExpiryThreadIntervalSeconds="120"
- memoryStoreEvictionPolicy="LRU"
- />
-
- <!--
- Sample caches. Following are some example caches. Remove these before use.
- -->
-
- <!--
- NOTE that the cache benchmarking fwk looks for a cache named "cache".
- -->
-
- <!--
- Sample distributed cache named sampleDistributedCache3.
- This cache replicates using defaults except that the asynchronous replication
- interval is set to 200ms.
- -->
- <cache name="cache"
- maxElementsInMemory="10000"
- eternal="false"
- timeToIdleSeconds="100"
- timeToLiveSeconds="100"
- overflowToDisk="false">
- <cacheEventListenerFactory
- class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
- properties="replicateAsynchronously=true, replicatePuts=true,
- replicateUpdates=true, replicateUpdatesViaCopy=true,
- replicateRemovals=true"/>
- </cache>
-
-</ehcache>
Copied: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-async.xml (from rev 6370, benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-repl-async.xml)
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-async.xml (rev 0)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-async.xml 2008-07-23 01:32:31 UTC (rev 6372)
@@ -0,0 +1,331 @@
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
+
+ <!--
+ DiskStore configuration
+
+ Sets the path to the directory where cache files are created.
+
+ If the path is a Java System Property it is replaced by its value in the
+ running VM.
+
+ The following properties are translated:
+ * user.home - User's home directory
+ * user.dir - User's current working directory
+ * java.io.tmpdir - Default temp file path
+
+ Subdirectories can be specified below the property e.g. java.io.tmpdir/one
+ -->
+ <diskStore path="java.io.tmpdir"/>
+
+ <!--
+ Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
+ which is notified when Caches are added or removed from the CacheManager.
+
+ The attributes of CacheManagerEventListenerFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the factory.
+
+ Sets the fully qualified class name to be registered as the CacheManager event listener.
+
+ The events include:
+ * adding a Cache
+ * removing a Cache
+
+ Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
+ of the implementer to safely handle the potential performance and thread safety issues
+ depending on what their listener is doing.
+
+ If no class is specified, no listener is created. There is no default.
+ -->
+ <cacheManagerEventListenerFactory class="" properties=""/>
+
+
+ <!--
+ (Enable for distributed operation)
+
+ Specifies a CacheManagerPeerProviderFactory which will be used to create a
+ CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
+
+ The attributes of cacheManagerPeerProviderFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the factory.
+
+ Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
+ CacheManager peers participating in the cluster:
+ * automatic, using a multicast group. This one automatically discovers peers and detects
+ changes such as peers entering and leaving the group
+ * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
+ configuration time.
+
+ Configuring Automatic Discovery:
+ Automatic discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
+ multicastGroupPort=4446, timeToLive=32"/>
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "automatic"
+ * multicastGroupAddress (mandatory) - specify a valid multicast group address
+ * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
+ traffic
+ * timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate.
+ By convention, the restrictions are:
+ 0 - the same host
+ 1 - the same subnet
+ 32 - the same site
+ 64 - the same region
+ 128 - the same continent
+ 255 - unrestricted
+
+ Configuring Manual Discovery:
+ Manual discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=manual,
+ rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
+ | //server1:40000/sampleCache2|//server2:40000/sampleCache2"/>
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "manual"
+ * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
+ //hostname:port
+
+ The hostname is the hostname of the remote CacheManager peer. The port is the listening
+ port of the RMICacheManagerPeerListener of the remote CacheManager peer.
+
+ An alternate CacheManagerPeerProviderFactory can be used for JNDI discovery of other
+ CacheManagers in the cluster. Only manual discovery is supported.
+
+ For cacheManagerPeerProviderFactory specify class
+ net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
+
+ Correspondingly for cacheManagerPeerListenerFactory specify class
+ net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactoryory.
+
+ Configuring JNDI Manual Discovery:
+ Manual JNDI discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory"
+ properties="peerDiscovery=manual, stashContexts=true, stashRemoteCachePeers=true,
+ jndiUrls=t3//server1:40000/sampleCache1|t3//server2:40000/sampleCache1
+ |t3//server1:40000/sampleCache2|t3//server2:40000/sampleCache2"/>
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "manual"
+ * stashContexts (optional) - specify "true" or "false". Defaults to true.
+ java.naming.Context objects are stashed for performance.
+ * stashRemoteCachePeers (optional) - specify "true" or "false". Defaults to true.
+ CachePeer objects are stashed for performance.
+ * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls,
+ in the form protocol//hostname:port
+ -->
+ <cacheManagerPeerProviderFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=automatic,
+ multicastGroupAddress=228.1.2.3,
+ multicastGroupPort=48866, timeToLive=64"/>
+
+
+ <!--
+ (Enable for distributed operation)
+
+ Specifies a CacheManagerPeerListenerFactory which will be used to create a
+ CacheManagerPeerListener, which
+ listens for messages from cache replicators participating in the cluster.
+
+ The attributes of cacheManagerPeerListenerFactory are:
+ class - a fully qualified factory class name
+ properties - comma separated properties having meaning only to the factory.
+
+ Ehcache comes with a built-in RMI-based distribution system. The listener component is
+ RMICacheManagerPeerListener which is configured using
+ RMICacheManagerPeerListenerFactory. It is configured as per the following example:
+
+ <cacheManagerPeerListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
+ properties="hostName=fully_qualified_hostname_or_ip,
+ port=40001,
+ socketTimeoutMillis=120000"/>
+
+ All properties are optional. They are:
+ * hostName - the hostName of the host the listener is running on. Specify
+ where the host is multihomed and you want to control the interface over which cluster
+ messages are received. Defaults to the host name of the default interface if not
+ specified.
+ * port - the port the listener listens on. This defaults to a free port if not specified.
+ * socketTimeoutMillis - the number of ms client sockets will stay open when sending
+ messages to the listener. This should be long enough for the slowest message.
+ If not specified it defaults 120000ms.
+
+
+ An alternate CacheManagerPeerListenerFactory can be also be used for JNDI binding of
+ listeners for messages from cache replicators participating in the cluster. For
+ cacheManagerPeerListenerFactory specify
+ class net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactory.
+ Correspondingly for cacheManagerPeerProviderFactory specify class
+ net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
+ Properties for JNDIRMICacheManagerPeerListenerFactory are the same as
+ RMICacheManagerPeerListenerFactory.
+
+ -->
+ <cacheManagerPeerListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
+ properties="hostName=127.0.0.1, socketTimeoutMillis=120000"/>
+
+
+ <!-- Cache configuration.
+
+ The following attributes are required.
+
+ name:
+ Sets the name of the cache. This is used to identify the cache. It must be unique.
+
+ maxElementsInMemory:
+ Sets the maximum number of objects that will be created in memory
+
+ maxElementsOnDisk:
+ Sets the maximum number of objects that will be maintained in the DiskStore
+ The default value is zero, meaning unlimited.
+
+ eternal:
+ Sets whether elements are eternal. If eternal, timeouts are ignored and the
+ element is never expired.
+
+ overflowToDisk:
+ Sets whether elements can overflow to disk when the memory store
+ has reached the maxInMemory limit.
+
+ The following attributes are optional.
+
+ timeToIdleSeconds:
+ Sets the time to idle for an element before it expires.
+ i.e. The maximum amount of time between accesses before an element expires
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that an Element can idle for infinity.
+ The default value is 0.
+
+ timeToLiveSeconds:
+ Sets the time to live for an element before it expires.
+ i.e. The maximum time between creation time and when an element expires.
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that and Element can live for infinity.
+ The default value is 0.
+
+ diskPersistent:
+ Whether the disk store persists between restarts of the Virtual Machine.
+ The default value is false.
+
+ diskExpiryThreadIntervalSeconds:
+ The number of seconds between runs of the disk expiry thread. The default value
+ is 120 seconds.
+
+ memoryStoreEvictionPolicy:
+ Policy would be enforced upon reaching the maxElementsInMemory limit. Default
+ policy is Least Recently Used (specified as LRU). Other policies available -
+ First In First Out (specified as FIFO) and Less Frequently Used
+ (specified as LFU)
+
+ Cache elements can also contain sub elements which take the same format of a factory class
+ and properties. Defined sub-elements are:
+
+ * cacheEventListenerFactory - Enables registration of listeners for cache events, such as
+ put, remove, update, and expire.
+
+ * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
+ cache on initialisation to prepopulate itself.
+
+ Each cache that will be distributed needs to set a cache event listener which replicates
+ messages to the other CacheManager peers. For the built-in RMI implementation this is done
+ by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
+ distributed cache's configuration as per the following example:
+
+ <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=true,
+ replicatePuts=true,
+ replicateUpdates=true,
+ replicateUpdatesViaCopy=true,
+ replicateRemovals=true "/>
+
+ The RMICacheReplicatorFactory recognises the following properties:
+
+ * replicatePuts=true|false - whether new elements placed in a cache are
+ replicated to others. Defaults to true.
+
+ * replicateUpdates=true|false - whether new elements which override an
+ element already existing with the same key are replicated. Defaults to true.
+
+ * replicateRemovals=true - whether element removals are replicated. Defaults to true.
+
+ * replicateAsynchronously=true | false - whether replications are
+ asynchronous (true) or synchronous (false). Defaults to true.
+
+ * replicateUpdatesViaCopy=true | false - whether the new elements are
+ copied to other caches (true), or whether a remove message is sent. Defaults to true.
+
+ * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
+ replicator runs at a set interval of milliseconds. The default is 1000. The minimum
+ is 10. This property is only applicable if replicateAsynchronously=true
+
+ The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
+ used. It is configured as per the following example:
+
+ <bootstrapCacheLoaderFactory
+ class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
+ properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>
+
+ The RMIBootstrapCacheLoaderFactory recognises the following optional properties:
+
+ * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
+ after the cache has started. If false, bootstrapping must complete before the cache is
+ made available. The default value is true.
+
+ * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
+ memory limits of the VM. This property allows the bootstraper to fetched elements in
+ chunks. The default chunk size is 5000000 (5MB).
+
+ -->
+
+ <!--
+ Mandatory Default Cache configuration. These settings will be applied to caches
+ created programmtically using CacheManager.add(String cacheName)
+ -->
+ <defaultCache
+ maxElementsInMemory="1000000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="true"
+ maxElementsOnDisk="10000000"
+ diskPersistent="false"
+ diskExpiryThreadIntervalSeconds="120"
+ memoryStoreEvictionPolicy="LRU"
+ />
+
+ <!--
+ Sample caches. Following are some example caches. Remove these before use.
+ -->
+
+ <!--
+ NOTE that the cache benchmarking fwk looks for a cache named "cache".
+ -->
+
+ <!--
+ Sample distributed cache named sampleDistributedCache3.
+ This cache replicates using defaults except that the asynchronous replication
+ interval is set to 200ms.
+ -->
+ <cache name="cache"
+ maxElementsInMemory="1000000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="false">
+ <cacheEventListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=true, replicatePuts=true,
+ replicateUpdates=true, replicateUpdatesViaCopy=true,
+ replicateRemovals=true"/>
+ </cache>
+
+</ehcache>
Deleted: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-sync.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-repl-sync.xml 2008-07-17 10:56:16 UTC (rev 6312)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-sync.xml 2008-07-23 01:32:31 UTC (rev 6372)
@@ -1,330 +0,0 @@
-<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
-
- <!--
- DiskStore configuration
-
- Sets the path to the directory where cache files are created.
-
- If the path is a Java System Property it is replaced by its value in the
- running VM.
-
- The following properties are translated:
- * user.home - User's home directory
- * user.dir - User's current working directory
- * java.io.tmpdir - Default temp file path
-
- Subdirectories can be specified below the property e.g. java.io.tmpdir/one
- -->
- <diskStore path="java.io.tmpdir"/>
-
- <!--
- Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
- which is notified when Caches are added or removed from the CacheManager.
-
- The attributes of CacheManagerEventListenerFactory are:
- * class - a fully qualified factory class name
- * properties - comma separated properties having meaning only to the factory.
-
- Sets the fully qualified class name to be registered as the CacheManager event listener.
-
- The events include:
- * adding a Cache
- * removing a Cache
-
- Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
- of the implementer to safely handle the potential performance and thread safety issues
- depending on what their listener is doing.
-
- If no class is specified, no listener is created. There is no default.
- -->
- <cacheManagerEventListenerFactory class="" properties=""/>
-
-
- <!--
- (Enable for distributed operation)
-
- Specifies a CacheManagerPeerProviderFactory which will be used to create a
- CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
-
- The attributes of cacheManagerPeerProviderFactory are:
- * class - a fully qualified factory class name
- * properties - comma separated properties having meaning only to the factory.
-
- Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
- CacheManager peers participating in the cluster:
- * automatic, using a multicast group. This one automatically discovers peers and detects
- changes such as peers entering and leaving the group
- * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
- configuration time.
-
- Configuring Automatic Discovery:
- Automatic discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
- multicastGroupPort=4446, timeToLive=32"/>
-
- Valid properties are:
- * peerDiscovery (mandatory) - specify "automatic"
- * multicastGroupAddress (mandatory) - specify a valid multicast group address
- * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
- traffic
- * timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate.
- By convention, the restrictions are:
- 0 - the same host
- 1 - the same subnet
- 32 - the same site
- 64 - the same region
- 128 - the same continent
- 255 - unrestricted
-
- Configuring Manual Discovery:
- Manual discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory class=
- "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=manual,
- rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
- | //server1:40000/sampleCache2|//server2:40000/sampleCache2"/>
-
- Valid properties are:
- * peerDiscovery (mandatory) - specify "manual"
- * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
- //hostname:port
-
- The hostname is the hostname of the remote CacheManager peer. The port is the listening
- port of the RMICacheManagerPeerListener of the remote CacheManager peer.
-
- An alternate CacheManagerPeerProviderFactory can be used for JNDI discovery of other
- CacheManagers in the cluster. Only manual discovery is supported.
-
- For cacheManagerPeerProviderFactory specify class
- net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
-
- Correspondingly for cacheManagerPeerListenerFactory specify class
- net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactoryory.
-
- Configuring JNDI Manual Discovery:
- Manual JNDI discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory class=
- "net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory"
- properties="peerDiscovery=manual, stashContexts=true, stashRemoteCachePeers=true,
- jndiUrls=t3//server1:40000/sampleCache1|t3//server2:40000/sampleCache1
- |t3//server1:40000/sampleCache2|t3//server2:40000/sampleCache2"/>
-
- Valid properties are:
- * peerDiscovery (mandatory) - specify "manual"
- * stashContexts (optional) - specify "true" or "false". Defaults to true.
- java.naming.Context objects are stashed for performance.
- * stashRemoteCachePeers (optional) - specify "true" or "false". Defaults to true.
- CachePeer objects are stashed for performance.
- * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls,
- in the form protocol//hostname:port
- -->
- <cacheManagerPeerProviderFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=automatic,
- multicastGroupAddress=228.1.2.3,
- multicastGroupPort=48866, timeToLive=64"/>
-
-
- <!--
- (Enable for distributed operation)
-
- Specifies a CacheManagerPeerListenerFactory which will be used to create a
- CacheManagerPeerListener, which
- listens for messages from cache replicators participating in the cluster.
-
- The attributes of cacheManagerPeerListenerFactory are:
- class - a fully qualified factory class name
- properties - comma separated properties having meaning only to the factory.
-
- Ehcache comes with a built-in RMI-based distribution system. The listener component is
- RMICacheManagerPeerListener which is configured using
- RMICacheManagerPeerListenerFactory. It is configured as per the following example:
-
- <cacheManagerPeerListenerFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
- properties="hostName=fully_qualified_hostname_or_ip,
- port=40001,
- socketTimeoutMillis=120000"/>
-
- All properties are optional. They are:
- * hostName - the hostName of the host the listener is running on. Specify
- where the host is multihomed and you want to control the interface over which cluster
- messages are received. Defaults to the host name of the default interface if not
- specified.
- * port - the port the listener listens on. This defaults to a free port if not specified.
- * socketTimeoutMillis - the number of ms client sockets will stay open when sending
- messages to the listener. This should be long enough for the slowest message.
- If not specified it defaults 120000ms.
-
-
- An alternate CacheManagerPeerListenerFactory can be also be used for JNDI binding of
- listeners for messages from cache replicators participating in the cluster. For
- cacheManagerPeerListenerFactory specify
- class net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactory.
- Correspondingly for cacheManagerPeerProviderFactory specify class
- net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
- Properties for JNDIRMICacheManagerPeerListenerFactory are the same as
- RMICacheManagerPeerListenerFactory.
-
- -->
- <cacheManagerPeerListenerFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
- properties="hostName=127.0.0.1, socketTimeoutMillis=120000"/>
-
-
- <!-- Cache configuration.
-
- The following attributes are required.
-
- name:
- Sets the name of the cache. This is used to identify the cache. It must be unique.
-
- maxElementsInMemory:
- Sets the maximum number of objects that will be created in memory
-
- maxElementsOnDisk:
- Sets the maximum number of objects that will be maintained in the DiskStore
- The default value is zero, meaning unlimited.
-
- eternal:
- Sets whether elements are eternal. If eternal, timeouts are ignored and the
- element is never expired.
-
- overflowToDisk:
- Sets whether elements can overflow to disk when the memory store
- has reached the maxInMemory limit.
-
- The following attributes are optional.
-
- timeToIdleSeconds:
- Sets the time to idle for an element before it expires.
- i.e. The maximum amount of time between accesses before an element expires
- Is only used if the element is not eternal.
- Optional attribute. A value of 0 means that an Element can idle for infinity.
- The default value is 0.
-
- timeToLiveSeconds:
- Sets the time to live for an element before it expires.
- i.e. The maximum time between creation time and when an element expires.
- Is only used if the element is not eternal.
- Optional attribute. A value of 0 means that and Element can live for infinity.
- The default value is 0.
-
- diskPersistent:
- Whether the disk store persists between restarts of the Virtual Machine.
- The default value is false.
-
- diskExpiryThreadIntervalSeconds:
- The number of seconds between runs of the disk expiry thread. The default value
- is 120 seconds.
-
- memoryStoreEvictionPolicy:
- Policy would be enforced upon reaching the maxElementsInMemory limit. Default
- policy is Least Recently Used (specified as LRU). Other policies available -
- First In First Out (specified as FIFO) and Less Frequently Used
- (specified as LFU)
-
- Cache elements can also contain sub elements which take the same format of a factory class
- and properties. Defined sub-elements are:
-
- * cacheEventListenerFactory - Enables registration of listeners for cache events, such as
- put, remove, update, and expire.
-
- * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
- cache on initialisation to prepopulate itself.
-
- Each cache that will be distributed needs to set a cache event listener which replicates
- messages to the other CacheManager peers. For the built-in RMI implementation this is done
- by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
- distributed cache's configuration as per the following example:
-
- <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
- properties="replicateAsynchronously=true,
- replicatePuts=true,
- replicateUpdates=true,
- replicateUpdatesViaCopy=true,
- replicateRemovals=true "/>
-
- The RMICacheReplicatorFactory recognises the following properties:
-
- * replicatePuts=true|false - whether new elements placed in a cache are
- replicated to others. Defaults to true.
-
- * replicateUpdates=true|false - whether new elements which override an
- element already existing with the same key are replicated. Defaults to true.
-
- * replicateRemovals=true - whether element removals are replicated. Defaults to true.
-
- * replicateAsynchronously=true | false - whether replications are
- asynchronous (true) or synchronous (false). Defaults to true.
-
- * replicateUpdatesViaCopy=true | false - whether the new elements are
- copied to other caches (true), or whether a remove message is sent. Defaults to true.
-
- * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
- replicator runs at a set interval of milliseconds. The default is 1000. The minimum
- is 10. This property is only applicable if replicateAsynchronously=true
-
- The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
- used. It is configured as per the following example:
-
- <bootstrapCacheLoaderFactory
- class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
- properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>
-
- The RMIBootstrapCacheLoaderFactory recognises the following optional properties:
-
- * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
- after the cache has started. If false, bootstrapping must complete before the cache is
- made available. The default value is true.
-
- * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
- memory limits of the VM. This property allows the bootstraper to fetched elements in
- chunks. The default chunk size is 5000000 (5MB).
-
- -->
-
- <!--
- Mandatory Default Cache configuration. These settings will be applied to caches
- created programmtically using CacheManager.add(String cacheName)
- -->
- <defaultCache
- maxElementsInMemory="10000"
- eternal="false"
- timeToIdleSeconds="120"
- timeToLiveSeconds="120"
- overflowToDisk="true"
- maxElementsOnDisk="10000000"
- diskPersistent="false"
- diskExpiryThreadIntervalSeconds="120"
- memoryStoreEvictionPolicy="LRU"
- />
-
- <!--
- Sample caches. Following are some example caches. Remove these before use.
- -->
-
- <!--
- NOTE that the cache benchmarking fwk looks for a cache named "cache".
- -->
-
- <!--
- Sample distributed cache named sampleDistributedCache2.
- This cache replicates using specific properties.
- It only replicates updates and does so synchronously via copy
- -->
- <cache name="cache"
- maxElementsInMemory="10000"
- eternal="false"
- timeToIdleSeconds="100"
- timeToLiveSeconds="100"
- overflowToDisk="false">
- <cacheEventListenerFactory
- class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
- properties="replicateAsynchronously=false, replicatePuts=true,
- replicateUpdates=true, replicateUpdatesViaCopy=true,
- replicateRemovals=true"/>
- </cache>
-</ehcache>
Copied: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-sync.xml (from rev 6370, benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-repl-sync.xml)
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-sync.xml (rev 0)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/conf/ehcache-repl-sync.xml 2008-07-23 01:32:31 UTC (rev 6372)
@@ -0,0 +1,330 @@
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
+
+ <!--
+ DiskStore configuration
+
+ Sets the path to the directory where cache files are created.
+
+ If the path is a Java System Property it is replaced by its value in the
+ running VM.
+
+ The following properties are translated:
+ * user.home - User's home directory
+ * user.dir - User's current working directory
+ * java.io.tmpdir - Default temp file path
+
+ Subdirectories can be specified below the property e.g. java.io.tmpdir/one
+ -->
+ <diskStore path="java.io.tmpdir"/>
+
+ <!--
+ Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
+ which is notified when Caches are added or removed from the CacheManager.
+
+ The attributes of CacheManagerEventListenerFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the factory.
+
+ Sets the fully qualified class name to be registered as the CacheManager event listener.
+
+ The events include:
+ * adding a Cache
+ * removing a Cache
+
+ Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
+ of the implementer to safely handle the potential performance and thread safety issues
+ depending on what their listener is doing.
+
+ If no class is specified, no listener is created. There is no default.
+ -->
+ <cacheManagerEventListenerFactory class="" properties=""/>
+
+
+ <!--
+ (Enable for distributed operation)
+
+ Specifies a CacheManagerPeerProviderFactory which will be used to create a
+ CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
+
+ The attributes of cacheManagerPeerProviderFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the factory.
+
+ Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
+ CacheManager peers participating in the cluster:
+ * automatic, using a multicast group. This one automatically discovers peers and detects
+ changes such as peers entering and leaving the group
+ * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
+ configuration time.
+
+ Configuring Automatic Discovery:
+ Automatic discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
+ multicastGroupPort=4446, timeToLive=32"/>
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "automatic"
+ * multicastGroupAddress (mandatory) - specify a valid multicast group address
+ * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
+ traffic
+ * timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate.
+ By convention, the restrictions are:
+ 0 - the same host
+ 1 - the same subnet
+ 32 - the same site
+ 64 - the same region
+ 128 - the same continent
+ 255 - unrestricted
+
+ Configuring Manual Discovery:
+ Manual discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=manual,
+ rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
+ | //server1:40000/sampleCache2|//server2:40000/sampleCache2"/>
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "manual"
+ * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
+ //hostname:port
+
+ The hostname is the hostname of the remote CacheManager peer. The port is the listening
+ port of the RMICacheManagerPeerListener of the remote CacheManager peer.
+
+ An alternate CacheManagerPeerProviderFactory can be used for JNDI discovery of other
+ CacheManagers in the cluster. Only manual discovery is supported.
+
+ For cacheManagerPeerProviderFactory specify class
+ net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
+
+ Correspondingly for cacheManagerPeerListenerFactory specify class
+ net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactoryory.
+
+ Configuring JNDI Manual Discovery:
+ Manual JNDI discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory"
+ properties="peerDiscovery=manual, stashContexts=true, stashRemoteCachePeers=true,
+ jndiUrls=t3//server1:40000/sampleCache1|t3//server2:40000/sampleCache1
+ |t3//server1:40000/sampleCache2|t3//server2:40000/sampleCache2"/>
+
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "manual"
+ * stashContexts (optional) - specify "true" or "false". Defaults to true.
+ java.naming.Context objects are stashed for performance.
+ * stashRemoteCachePeers (optional) - specify "true" or "false". Defaults to true.
+ CachePeer objects are stashed for performance.
+ * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls,
+ in the form protocol//hostname:port
+ -->
+ <cacheManagerPeerProviderFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=automatic,
+ multicastGroupAddress=228.1.2.3,
+ multicastGroupPort=48866, timeToLive=64"/>
+
+
+ <!--
+ (Enable for distributed operation)
+
+ Specifies a CacheManagerPeerListenerFactory which will be used to create a
+ CacheManagerPeerListener, which
+ listens for messages from cache replicators participating in the cluster.
+
+ The attributes of cacheManagerPeerListenerFactory are:
+ class - a fully qualified factory class name
+ properties - comma separated properties having meaning only to the factory.
+
+ Ehcache comes with a built-in RMI-based distribution system. The listener component is
+ RMICacheManagerPeerListener which is configured using
+ RMICacheManagerPeerListenerFactory. It is configured as per the following example:
+
+ <cacheManagerPeerListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
+ properties="hostName=fully_qualified_hostname_or_ip,
+ port=40001,
+ socketTimeoutMillis=120000"/>
+
+ All properties are optional. They are:
+ * hostName - the hostName of the host the listener is running on. Specify
+ where the host is multihomed and you want to control the interface over which cluster
+ messages are received. Defaults to the host name of the default interface if not
+ specified.
+ * port - the port the listener listens on. This defaults to a free port if not specified.
+ * socketTimeoutMillis - the number of ms client sockets will stay open when sending
+ messages to the listener. This should be long enough for the slowest message.
+ If not specified it defaults 120000ms.
+
+
+ An alternate CacheManagerPeerListenerFactory can be also be used for JNDI binding of
+ listeners for messages from cache replicators participating in the cluster. For
+ cacheManagerPeerListenerFactory specify
+ class net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactory.
+ Correspondingly for cacheManagerPeerProviderFactory specify class
+ net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
+ Properties for JNDIRMICacheManagerPeerListenerFactory are the same as
+ RMICacheManagerPeerListenerFactory.
+
+ -->
+ <cacheManagerPeerListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
+ properties="hostName=127.0.0.1, socketTimeoutMillis=120000"/>
+
+
+ <!-- Cache configuration.
+
+ The following attributes are required.
+
+ name:
+ Sets the name of the cache. This is used to identify the cache. It must be unique.
+
+ maxElementsInMemory:
+ Sets the maximum number of objects that will be created in memory
+
+ maxElementsOnDisk:
+ Sets the maximum number of objects that will be maintained in the DiskStore
+ The default value is zero, meaning unlimited.
+
+ eternal:
+ Sets whether elements are eternal. If eternal, timeouts are ignored and the
+ element is never expired.
+
+ overflowToDisk:
+ Sets whether elements can overflow to disk when the memory store
+ has reached the maxInMemory limit.
+
+ The following attributes are optional.
+
+ timeToIdleSeconds:
+ Sets the time to idle for an element before it expires.
+ i.e. The maximum amount of time between accesses before an element expires
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that an Element can idle for infinity.
+ The default value is 0.
+
+ timeToLiveSeconds:
+ Sets the time to live for an element before it expires.
+ i.e. The maximum time between creation time and when an element expires.
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that and Element can live for infinity.
+ The default value is 0.
+
+ diskPersistent:
+ Whether the disk store persists between restarts of the Virtual Machine.
+ The default value is false.
+
+ diskExpiryThreadIntervalSeconds:
+ The number of seconds between runs of the disk expiry thread. The default value
+ is 120 seconds.
+
+ memoryStoreEvictionPolicy:
+ Policy would be enforced upon reaching the maxElementsInMemory limit. Default
+ policy is Least Recently Used (specified as LRU). Other policies available -
+ First In First Out (specified as FIFO) and Less Frequently Used
+ (specified as LFU)
+
+ Cache elements can also contain sub elements which take the same format of a factory class
+ and properties. Defined sub-elements are:
+
+ * cacheEventListenerFactory - Enables registration of listeners for cache events, such as
+ put, remove, update, and expire.
+
+ * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
+ cache on initialisation to prepopulate itself.
+
+ Each cache that will be distributed needs to set a cache event listener which replicates
+ messages to the other CacheManager peers. For the built-in RMI implementation this is done
+ by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
+ distributed cache's configuration as per the following example:
+
+ <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=true,
+ replicatePuts=true,
+ replicateUpdates=true,
+ replicateUpdatesViaCopy=true,
+ replicateRemovals=true "/>
+
+ The RMICacheReplicatorFactory recognises the following properties:
+
+ * replicatePuts=true|false - whether new elements placed in a cache are
+ replicated to others. Defaults to true.
+
+ * replicateUpdates=true|false - whether new elements which override an
+ element already existing with the same key are replicated. Defaults to true.
+
+ * replicateRemovals=true - whether element removals are replicated. Defaults to true.
+
+ * replicateAsynchronously=true | false - whether replications are
+ asynchronous (true) or synchronous (false). Defaults to true.
+
+ * replicateUpdatesViaCopy=true | false - whether the new elements are
+ copied to other caches (true), or whether a remove message is sent. Defaults to true.
+
+ * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
+ replicator runs at a set interval of milliseconds. The default is 1000. The minimum
+ is 10. This property is only applicable if replicateAsynchronously=true
+
+ The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
+ used. It is configured as per the following example:
+
+ <bootstrapCacheLoaderFactory
+ class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
+ properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>
+
+ The RMIBootstrapCacheLoaderFactory recognises the following optional properties:
+
+ * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
+ after the cache has started. If false, bootstrapping must complete before the cache is
+ made available. The default value is true.
+
+ * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
+ memory limits of the VM. This property allows the bootstraper to fetched elements in
+ chunks. The default chunk size is 5000000 (5MB).
+
+ -->
+
+ <!--
+ Mandatory Default Cache configuration. These settings will be applied to caches
+ created programmtically using CacheManager.add(String cacheName)
+ -->
+ <defaultCache
+ maxElementsInMemory="1000000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="true"
+ maxElementsOnDisk="10000000"
+ diskPersistent="false"
+ diskExpiryThreadIntervalSeconds="120"
+ memoryStoreEvictionPolicy="LRU"
+ />
+
+ <!--
+ Sample caches. Following are some example caches. Remove these before use.
+ -->
+
+ <!--
+ NOTE that the cache benchmarking fwk looks for a cache named "cache".
+ -->
+
+ <!--
+ Sample distributed cache named sampleDistributedCache2.
+ This cache replicates using specific properties.
+ It only replicates updates and does so synchronously via copy
+ -->
+ <cache name="cache"
+ maxElementsInMemory="1000000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="false">
+ <cacheEventListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=false, replicatePuts=true,
+ replicateUpdates=true, replicateUpdatesViaCopy=true,
+ replicateRemovals=true"/>
+ </cache>
+</ehcache>
Deleted: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/config.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/config.sh 2008-07-17 10:56:16 UTC (rev 6312)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/config.sh 2008-07-23 01:32:31 UTC (rev 6372)
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-#see "$CACHE_ROOT/cache-products/cache.sh" for details
-
-THIS_DIR="./cache-products/ehcache-1.4.1"
-
-#setting up classpath
-for JAR in $THIS_DIR/lib/*
-do
- CLASSPATH=$CLASSPATH:$JAR
-done
-
-CLASSPATH="$CLASSPATH:./classes/production/ehcache-1.4.1"
-CLASSPATH="$CLASSPATH:$THIS_DIR/conf"
-#--classpath was set
-
-#additional JVM options
-JVM_OPTIONS="$JVM_OPTIONS -Xmx1024m -Djava.net.preferIPv4Stack=true" JVM_OPTIONS="$JVM_OPTIONS -DcacheBenchFwk.cacheWrapperClassName=org.cachebench.cachewrappers.EHCacheWrapper"
Copied: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/config.sh (from rev 6371, benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/config.sh)
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/config.sh (rev 0)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/config.sh 2008-07-23 01:32:31 UTC (rev 6372)
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+#see "$CACHE_ROOT/cache-products/cache.sh" for details
+
+THIS_DIR="./cache-products/ehcache-1.5.0"
+
+#setting up classpath
+for JAR in $THIS_DIR/lib/*
+do
+ CLASSPATH=$CLASSPATH:$JAR
+done
+
+CLASSPATH="$CLASSPATH:./classes/production/ehcache-1.5.0"
+CLASSPATH="$CLASSPATH:$THIS_DIR/conf"
+#--classpath was set
+
+#additional JVM options
+JVM_OPTIONS="$JVM_OPTIONS -Xmx1024m -Djava.net.preferIPv4Stack=true" JVM_OPTIONS="$JVM_OPTIONS -DcacheBenchFwk.cacheWrapperClassName=org.cachebench.cachewrappers.EHCacheWrapper"
Deleted: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/lib/ehcache.jar
===================================================================
(Binary files differ)
Copied: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.5.0/lib/ehcache.jar (from rev 6371, benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/lib/ehcache.jar)
===================================================================
(Binary files differ)
15 years, 10 months
JBoss Cache SVN: r6371 - in benchmarks/benchmark-fwk/trunk: cache-products/ehcache-1.4.1 and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-22 21:31:41 -0400 (Tue, 22 Jul 2008)
New Revision: 6371
Modified:
benchmarks/benchmark-fwk/trunk/build.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/config.sh
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/lib/ehcache.jar
benchmarks/benchmark-fwk/trunk/runAllLocal.sh
Log:
Upgraded EHCache to 1.5.0
Modified: benchmarks/benchmark-fwk/trunk/build.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/build.xml 2008-07-23 01:25:27 UTC (rev 6370)
+++ benchmarks/benchmark-fwk/trunk/build.xml 2008-07-23 01:31:41 UTC (rev 6371)
@@ -80,17 +80,17 @@
</target>
<target name="compile.module.ehcache141" depends="compile.module.framework"
- description="Compile module ehcache-1.4.1; production classes">
- <mkdir dir="./classes/production/ehcache-1.4.1"/>
- <javac destdir="./classes/production/ehcache-1.4.1" debug="${compiler.debug}"
+ description="Compile module ehcache-1.5.0; production classes">
+ <mkdir dir="./classes/production/ehcache-1.5.0"/>
+ <javac destdir="./classes/production/ehcache-1.5.0" debug="${compiler.debug}"
nowarn="${compiler.generate.no.warnings}" fork="true">
<classpath>
- <fileset dir="./cache-products/ehcache-1.4.1/lib" includes="*.jar"/>
- <pathelement location="./cache-products/ehcache-1.4.1/conf"/>
+ <fileset dir="./cache-products/ehcache-1.5.0/lib" includes="*.jar"/>
+ <pathelement location="./cache-products/ehcache-1.5.0/conf"/>
<pathelement location="${framework.output.dir}"/>
- <pathelement location="./classes/production/ehcache-1.4.1"/>
+ <pathelement location="./classes/production/ehcache-1.5.0"/>
</classpath>
- <src path="./cache-products/ehcache-1.4.1/src"/>
+ <src path="./cache-products/ehcache-1.5.0/src"/>
</javac>
</target>
Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/config.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/config.sh 2008-07-23 01:25:27 UTC (rev 6370)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/config.sh 2008-07-23 01:31:41 UTC (rev 6371)
@@ -2,7 +2,7 @@
#see "$CACHE_ROOT/cache-products/cache.sh" for details
-THIS_DIR="./cache-products/ehcache-1.4.1"
+THIS_DIR="./cache-products/ehcache-1.5.0"
#setting up classpath
for JAR in $THIS_DIR/lib/*
@@ -10,7 +10,7 @@
CLASSPATH=$CLASSPATH:$JAR
done
-CLASSPATH="$CLASSPATH:./classes/production/ehcache-1.4.1"
+CLASSPATH="$CLASSPATH:./classes/production/ehcache-1.5.0"
CLASSPATH="$CLASSPATH:$THIS_DIR/conf"
#--classpath was set
Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/lib/ehcache.jar
===================================================================
(Binary files differ)
Modified: benchmarks/benchmark-fwk/trunk/runAllLocal.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/runAllLocal.sh 2008-07-23 01:25:27 UTC (rev 6370)
+++ benchmarks/benchmark-fwk/trunk/runAllLocal.sh 2008-07-23 01:31:41 UTC (rev 6371)
@@ -6,7 +6,7 @@
./runLocalNode.sh jbosscache-3.0.0 mvcc-local-RR.xml
./runLocalNode.sh jbosscache-3.0.0 mvcc-local-RC.xml
./runLocalNode.sh jbosscache-3.0.0 pess-local-NONE.xml
-./runLocalNode.sh ehcache-1.4.1 ehcache-local.xml
+./runLocalNode.sh ehcache-1.5.0 ehcache-local.xml
mkdir output
mv data* ./output
15 years, 10 months
JBoss Cache SVN: r6370 - in benchmarks/benchmark-fwk/trunk: cache-products/jbosscache-3.0.0/lib and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-22 21:25:27 -0400 (Tue, 22 Jul 2008)
New Revision: 6370
Modified:
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-local.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-repl-async.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-repl-sync.xml
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/lib/jbosscache-core.jar
benchmarks/benchmark-fwk/trunk/conf/log4j.xml
Log:
Updated EHCache confs and JBC jar
Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-local.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-local.xml 2008-07-23 01:17:14 UTC (rev 6369)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-local.xml 2008-07-23 01:25:27 UTC (rev 6370)
@@ -120,11 +120,13 @@
* jndiUrls (mandatory) - specify a pipe separated list of jndiUrls,
in the form protocol//hostname:port
-->
+ <!--
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic,
multicastGroupAddress=228.1.2.3,
multicastGroupPort=48866, timeToLive=64"/>
+ -->
<!--
@@ -169,9 +171,11 @@
RMICacheManagerPeerListenerFactory.
-->
+ <!--
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=127.0.0.1, socketTimeoutMillis=120000"/>
+ -->
<!-- Cache configuration.
@@ -291,7 +295,7 @@
created programmtically using CacheManager.add(String cacheName)
-->
<defaultCache
- maxElementsInMemory="10000"
+ maxElementsInMemory="1000000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
@@ -316,10 +320,10 @@
It only replicates updates and does so synchronously via copy
-->
<cache name="cache"
- maxElementsInMemory="10000"
+ maxElementsInMemory="1000000"
eternal="false"
- timeToIdleSeconds="100"
- timeToLiveSeconds="100"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
overflowToDisk="false">
</cache>
</ehcache>
Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-repl-async.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-repl-async.xml 2008-07-23 01:17:14 UTC (rev 6369)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-repl-async.xml 2008-07-23 01:25:27 UTC (rev 6370)
@@ -1,329 +1,329 @@
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
- <!--
- DiskStore configuration
+ <!--
+ DiskStore configuration
- Sets the path to the directory where cache files are created.
+ Sets the path to the directory where cache files are created.
- If the path is a Java System Property it is replaced by its value in the
- running VM.
+ If the path is a Java System Property it is replaced by its value in the
+ running VM.
- The following properties are translated:
- * user.home - User's home directory
- * user.dir - User's current working directory
- * java.io.tmpdir - Default temp file path
+ The following properties are translated:
+ * user.home - User's home directory
+ * user.dir - User's current working directory
+ * java.io.tmpdir - Default temp file path
- Subdirectories can be specified below the property e.g. java.io.tmpdir/one
- -->
- <diskStore path="java.io.tmpdir"/>
+ Subdirectories can be specified below the property e.g. java.io.tmpdir/one
+ -->
+ <diskStore path="java.io.tmpdir"/>
- <!--
- Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
- which is notified when Caches are added or removed from the CacheManager.
+ <!--
+ Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
+ which is notified when Caches are added or removed from the CacheManager.
- The attributes of CacheManagerEventListenerFactory are:
- * class - a fully qualified factory class name
- * properties - comma separated properties having meaning only to the factory.
+ The attributes of CacheManagerEventListenerFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the factory.
- Sets the fully qualified class name to be registered as the CacheManager event listener.
+ Sets the fully qualified class name to be registered as the CacheManager event listener.
- The events include:
- * adding a Cache
- * removing a Cache
+ The events include:
+ * adding a Cache
+ * removing a Cache
- Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
- of the implementer to safely handle the potential performance and thread safety issues
- depending on what their listener is doing.
+ Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
+ of the implementer to safely handle the potential performance and thread safety issues
+ depending on what their listener is doing.
- If no class is specified, no listener is created. There is no default.
- -->
- <cacheManagerEventListenerFactory class="" properties=""/>
+ If no class is specified, no listener is created. There is no default.
+ -->
+ <cacheManagerEventListenerFactory class="" properties=""/>
- <!--
- (Enable for distributed operation)
+ <!--
+ (Enable for distributed operation)
- Specifies a CacheManagerPeerProviderFactory which will be used to create a
- CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
+ Specifies a CacheManagerPeerProviderFactory which will be used to create a
+ CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
- The attributes of cacheManagerPeerProviderFactory are:
- * class - a fully qualified factory class name
- * properties - comma separated properties having meaning only to the factory.
+ The attributes of cacheManagerPeerProviderFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the factory.
- Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
- CacheManager peers participating in the cluster:
- * automatic, using a multicast group. This one automatically discovers peers and detects
- changes such as peers entering and leaving the group
- * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
- configuration time.
+ Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
+ CacheManager peers participating in the cluster:
+ * automatic, using a multicast group. This one automatically discovers peers and detects
+ changes such as peers entering and leaving the group
+ * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
+ configuration time.
- Configuring Automatic Discovery:
- Automatic discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
- multicastGroupPort=4446, timeToLive=32"/>
+ Configuring Automatic Discovery:
+ Automatic discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
+ multicastGroupPort=4446, timeToLive=32"/>
- Valid properties are:
- * peerDiscovery (mandatory) - specify "automatic"
- * multicastGroupAddress (mandatory) - specify a valid multicast group address
- * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
- traffic
- * timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate.
- By convention, the restrictions are:
- 0 - the same host
- 1 - the same subnet
- 32 - the same site
- 64 - the same region
- 128 - the same continent
- 255 - unrestricted
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "automatic"
+ * multicastGroupAddress (mandatory) - specify a valid multicast group address
+ * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
+ traffic
+ * timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate.
+ By convention, the restrictions are:
+ 0 - the same host
+ 1 - the same subnet
+ 32 - the same site
+ 64 - the same region
+ 128 - the same continent
+ 255 - unrestricted
- Configuring Manual Discovery:
- Manual discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory class=
- "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=manual,
- rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
- | //server1:40000/sampleCache2|//server2:40000/sampleCache2"/>
+ Configuring Manual Discovery:
+ Manual discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=manual,
+ rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
+ | //server1:40000/sampleCache2|//server2:40000/sampleCache2"/>
- Valid properties are:
- * peerDiscovery (mandatory) - specify "manual"
- * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
- //hostname:port
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "manual"
+ * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
+ //hostname:port
- The hostname is the hostname of the remote CacheManager peer. The port is the listening
- port of the RMICacheManagerPeerListener of the remote CacheManager peer.
+ The hostname is the hostname of the remote CacheManager peer. The port is the listening
+ port of the RMICacheManagerPeerListener of the remote CacheManager peer.
- An alternate CacheManagerPeerProviderFactory can be used for JNDI discovery of other
- CacheManagers in the cluster. Only manual discovery is supported.
+ An alternate CacheManagerPeerProviderFactory can be used for JNDI discovery of other
+ CacheManagers in the cluster. Only manual discovery is supported.
- For cacheManagerPeerProviderFactory specify class
- net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
+ For cacheManagerPeerProviderFactory specify class
+ net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
- Correspondingly for cacheManagerPeerListenerFactory specify class
- net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactoryory.
+ Correspondingly for cacheManagerPeerListenerFactory specify class
+ net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactoryory.
- Configuring JNDI Manual Discovery:
- Manual JNDI discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory class=
- "net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory"
- properties="peerDiscovery=manual, stashContexts=true, stashRemoteCachePeers=true,
- jndiUrls=t3//server1:40000/sampleCache1|t3//server2:40000/sampleCache1
- |t3//server1:40000/sampleCache2|t3//server2:40000/sampleCache2"/>
+ Configuring JNDI Manual Discovery:
+ Manual JNDI discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory"
+ properties="peerDiscovery=manual, stashContexts=true, stashRemoteCachePeers=true,
+ jndiUrls=t3//server1:40000/sampleCache1|t3//server2:40000/sampleCache1
+ |t3//server1:40000/sampleCache2|t3//server2:40000/sampleCache2"/>
- Valid properties are:
- * peerDiscovery (mandatory) - specify "manual"
- * stashContexts (optional) - specify "true" or "false". Defaults to true.
- java.naming.Context objects are stashed for performance.
- * stashRemoteCachePeers (optional) - specify "true" or "false". Defaults to true.
- CachePeer objects are stashed for performance.
- * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls,
- in the form protocol//hostname:port
- -->
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "manual"
+ * stashContexts (optional) - specify "true" or "false". Defaults to true.
+ java.naming.Context objects are stashed for performance.
+ * stashRemoteCachePeers (optional) - specify "true" or "false". Defaults to true.
+ CachePeer objects are stashed for performance.
+ * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls,
+ in the form protocol//hostname:port
+ -->
<cacheManagerPeerProviderFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=automatic,
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=automatic,
multicastGroupAddress=228.1.2.3,
multicastGroupPort=48866, timeToLive=64"/>
- <!--
- (Enable for distributed operation)
+ <!--
+ (Enable for distributed operation)
- Specifies a CacheManagerPeerListenerFactory which will be used to create a
- CacheManagerPeerListener, which
- listens for messages from cache replicators participating in the cluster.
+ Specifies a CacheManagerPeerListenerFactory which will be used to create a
+ CacheManagerPeerListener, which
+ listens for messages from cache replicators participating in the cluster.
- The attributes of cacheManagerPeerListenerFactory are:
- class - a fully qualified factory class name
- properties - comma separated properties having meaning only to the factory.
+ The attributes of cacheManagerPeerListenerFactory are:
+ class - a fully qualified factory class name
+ properties - comma separated properties having meaning only to the factory.
- Ehcache comes with a built-in RMI-based distribution system. The listener component is
- RMICacheManagerPeerListener which is configured using
- RMICacheManagerPeerListenerFactory. It is configured as per the following example:
+ Ehcache comes with a built-in RMI-based distribution system. The listener component is
+ RMICacheManagerPeerListener which is configured using
+ RMICacheManagerPeerListenerFactory. It is configured as per the following example:
- <cacheManagerPeerListenerFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
- properties="hostName=fully_qualified_hostname_or_ip,
- port=40001,
- socketTimeoutMillis=120000"/>
+ <cacheManagerPeerListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
+ properties="hostName=fully_qualified_hostname_or_ip,
+ port=40001,
+ socketTimeoutMillis=120000"/>
- All properties are optional. They are:
- * hostName - the hostName of the host the listener is running on. Specify
- where the host is multihomed and you want to control the interface over which cluster
- messages are received. Defaults to the host name of the default interface if not
- specified.
- * port - the port the listener listens on. This defaults to a free port if not specified.
- * socketTimeoutMillis - the number of ms client sockets will stay open when sending
- messages to the listener. This should be long enough for the slowest message.
- If not specified it defaults 120000ms.
+ All properties are optional. They are:
+ * hostName - the hostName of the host the listener is running on. Specify
+ where the host is multihomed and you want to control the interface over which cluster
+ messages are received. Defaults to the host name of the default interface if not
+ specified.
+ * port - the port the listener listens on. This defaults to a free port if not specified.
+ * socketTimeoutMillis - the number of ms client sockets will stay open when sending
+ messages to the listener. This should be long enough for the slowest message.
+ If not specified it defaults 120000ms.
- An alternate CacheManagerPeerListenerFactory can be also be used for JNDI binding of
- listeners for messages from cache replicators participating in the cluster. For
- cacheManagerPeerListenerFactory specify
- class net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactory.
- Correspondingly for cacheManagerPeerProviderFactory specify class
- net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
- Properties for JNDIRMICacheManagerPeerListenerFactory are the same as
- RMICacheManagerPeerListenerFactory.
+ An alternate CacheManagerPeerListenerFactory can be also be used for JNDI binding of
+ listeners for messages from cache replicators participating in the cluster. For
+ cacheManagerPeerListenerFactory specify
+ class net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactory.
+ Correspondingly for cacheManagerPeerProviderFactory specify class
+ net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
+ Properties for JNDIRMICacheManagerPeerListenerFactory are the same as
+ RMICacheManagerPeerListenerFactory.
- -->
+ -->
<cacheManagerPeerListenerFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
- properties="hostName=127.0.0.1, socketTimeoutMillis=120000"/>
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
+ properties="hostName=127.0.0.1, socketTimeoutMillis=120000"/>
- <!-- Cache configuration.
+ <!-- Cache configuration.
- The following attributes are required.
+ The following attributes are required.
- name:
- Sets the name of the cache. This is used to identify the cache. It must be unique.
+ name:
+ Sets the name of the cache. This is used to identify the cache. It must be unique.
- maxElementsInMemory:
- Sets the maximum number of objects that will be created in memory
+ maxElementsInMemory:
+ Sets the maximum number of objects that will be created in memory
- maxElementsOnDisk:
- Sets the maximum number of objects that will be maintained in the DiskStore
- The default value is zero, meaning unlimited.
+ maxElementsOnDisk:
+ Sets the maximum number of objects that will be maintained in the DiskStore
+ The default value is zero, meaning unlimited.
- eternal:
- Sets whether elements are eternal. If eternal, timeouts are ignored and the
- element is never expired.
+ eternal:
+ Sets whether elements are eternal. If eternal, timeouts are ignored and the
+ element is never expired.
- overflowToDisk:
- Sets whether elements can overflow to disk when the memory store
- has reached the maxInMemory limit.
+ overflowToDisk:
+ Sets whether elements can overflow to disk when the memory store
+ has reached the maxInMemory limit.
- The following attributes are optional.
+ The following attributes are optional.
- timeToIdleSeconds:
- Sets the time to idle for an element before it expires.
- i.e. The maximum amount of time between accesses before an element expires
- Is only used if the element is not eternal.
- Optional attribute. A value of 0 means that an Element can idle for infinity.
- The default value is 0.
+ timeToIdleSeconds:
+ Sets the time to idle for an element before it expires.
+ i.e. The maximum amount of time between accesses before an element expires
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that an Element can idle for infinity.
+ The default value is 0.
- timeToLiveSeconds:
- Sets the time to live for an element before it expires.
- i.e. The maximum time between creation time and when an element expires.
- Is only used if the element is not eternal.
- Optional attribute. A value of 0 means that and Element can live for infinity.
- The default value is 0.
+ timeToLiveSeconds:
+ Sets the time to live for an element before it expires.
+ i.e. The maximum time between creation time and when an element expires.
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that and Element can live for infinity.
+ The default value is 0.
- diskPersistent:
- Whether the disk store persists between restarts of the Virtual Machine.
- The default value is false.
+ diskPersistent:
+ Whether the disk store persists between restarts of the Virtual Machine.
+ The default value is false.
- diskExpiryThreadIntervalSeconds:
- The number of seconds between runs of the disk expiry thread. The default value
- is 120 seconds.
+ diskExpiryThreadIntervalSeconds:
+ The number of seconds between runs of the disk expiry thread. The default value
+ is 120 seconds.
- memoryStoreEvictionPolicy:
- Policy would be enforced upon reaching the maxElementsInMemory limit. Default
- policy is Least Recently Used (specified as LRU). Other policies available -
- First In First Out (specified as FIFO) and Less Frequently Used
- (specified as LFU)
+ memoryStoreEvictionPolicy:
+ Policy would be enforced upon reaching the maxElementsInMemory limit. Default
+ policy is Least Recently Used (specified as LRU). Other policies available -
+ First In First Out (specified as FIFO) and Less Frequently Used
+ (specified as LFU)
- Cache elements can also contain sub elements which take the same format of a factory class
- and properties. Defined sub-elements are:
+ Cache elements can also contain sub elements which take the same format of a factory class
+ and properties. Defined sub-elements are:
- * cacheEventListenerFactory - Enables registration of listeners for cache events, such as
- put, remove, update, and expire.
+ * cacheEventListenerFactory - Enables registration of listeners for cache events, such as
+ put, remove, update, and expire.
- * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
- cache on initialisation to prepopulate itself.
+ * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
+ cache on initialisation to prepopulate itself.
- Each cache that will be distributed needs to set a cache event listener which replicates
- messages to the other CacheManager peers. For the built-in RMI implementation this is done
- by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
- distributed cache's configuration as per the following example:
+ Each cache that will be distributed needs to set a cache event listener which replicates
+ messages to the other CacheManager peers. For the built-in RMI implementation this is done
+ by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
+ distributed cache's configuration as per the following example:
- <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
- properties="replicateAsynchronously=true,
- replicatePuts=true,
- replicateUpdates=true,
- replicateUpdatesViaCopy=true,
- replicateRemovals=true "/>
+ <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=true,
+ replicatePuts=true,
+ replicateUpdates=true,
+ replicateUpdatesViaCopy=true,
+ replicateRemovals=true "/>
- The RMICacheReplicatorFactory recognises the following properties:
+ The RMICacheReplicatorFactory recognises the following properties:
- * replicatePuts=true|false - whether new elements placed in a cache are
- replicated to others. Defaults to true.
+ * replicatePuts=true|false - whether new elements placed in a cache are
+ replicated to others. Defaults to true.
- * replicateUpdates=true|false - whether new elements which override an
- element already existing with the same key are replicated. Defaults to true.
+ * replicateUpdates=true|false - whether new elements which override an
+ element already existing with the same key are replicated. Defaults to true.
- * replicateRemovals=true - whether element removals are replicated. Defaults to true.
+ * replicateRemovals=true - whether element removals are replicated. Defaults to true.
- * replicateAsynchronously=true | false - whether replications are
- asynchronous (true) or synchronous (false). Defaults to true.
+ * replicateAsynchronously=true | false - whether replications are
+ asynchronous (true) or synchronous (false). Defaults to true.
- * replicateUpdatesViaCopy=true | false - whether the new elements are
- copied to other caches (true), or whether a remove message is sent. Defaults to true.
+ * replicateUpdatesViaCopy=true | false - whether the new elements are
+ copied to other caches (true), or whether a remove message is sent. Defaults to true.
- * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
- replicator runs at a set interval of milliseconds. The default is 1000. The minimum
- is 10. This property is only applicable if replicateAsynchronously=true
+ * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
+ replicator runs at a set interval of milliseconds. The default is 1000. The minimum
+ is 10. This property is only applicable if replicateAsynchronously=true
- The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
- used. It is configured as per the following example:
+ The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
+ used. It is configured as per the following example:
- <bootstrapCacheLoaderFactory
- class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
- properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>
+ <bootstrapCacheLoaderFactory
+ class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
+ properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>
- The RMIBootstrapCacheLoaderFactory recognises the following optional properties:
+ The RMIBootstrapCacheLoaderFactory recognises the following optional properties:
- * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
- after the cache has started. If false, bootstrapping must complete before the cache is
- made available. The default value is true.
+ * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
+ after the cache has started. If false, bootstrapping must complete before the cache is
+ made available. The default value is true.
- * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
- memory limits of the VM. This property allows the bootstraper to fetched elements in
- chunks. The default chunk size is 5000000 (5MB).
+ * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
+ memory limits of the VM. This property allows the bootstraper to fetched elements in
+ chunks. The default chunk size is 5000000 (5MB).
- -->
+ -->
- <!--
- Mandatory Default Cache configuration. These settings will be applied to caches
- created programmtically using CacheManager.add(String cacheName)
- -->
- <defaultCache
- maxElementsInMemory="10000"
- eternal="false"
- timeToIdleSeconds="120"
- timeToLiveSeconds="120"
- overflowToDisk="true"
- maxElementsOnDisk="10000000"
- diskPersistent="false"
- diskExpiryThreadIntervalSeconds="120"
- memoryStoreEvictionPolicy="LRU"
- />
+ <!--
+ Mandatory Default Cache configuration. These settings will be applied to caches
+ created programmtically using CacheManager.add(String cacheName)
+ -->
+ <defaultCache
+ maxElementsInMemory="1000000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="true"
+ maxElementsOnDisk="10000000"
+ diskPersistent="false"
+ diskExpiryThreadIntervalSeconds="120"
+ memoryStoreEvictionPolicy="LRU"
+ />
- <!--
- Sample caches. Following are some example caches. Remove these before use.
- -->
+ <!--
+ Sample caches. Following are some example caches. Remove these before use.
+ -->
<!--
NOTE that the cache benchmarking fwk looks for a cache named "cache".
-->
-
- <!--
- Sample distributed cache named sampleDistributedCache3.
- This cache replicates using defaults except that the asynchronous replication
- interval is set to 200ms.
- -->
+
+ <!--
+ Sample distributed cache named sampleDistributedCache3.
+ This cache replicates using defaults except that the asynchronous replication
+ interval is set to 200ms.
+ -->
<cache name="cache"
- maxElementsInMemory="10000"
+ maxElementsInMemory="1000000"
eternal="false"
- timeToIdleSeconds="100"
- timeToLiveSeconds="100"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
overflowToDisk="false">
- <cacheEventListenerFactory
- class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
- properties="replicateAsynchronously=true, replicatePuts=true,
+ <cacheEventListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=true, replicatePuts=true,
replicateUpdates=true, replicateUpdatesViaCopy=true,
replicateRemovals=true"/>
</cache>
Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-repl-sync.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-repl-sync.xml 2008-07-23 01:17:14 UTC (rev 6369)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.4.1/conf/ehcache-repl-sync.xml 2008-07-23 01:25:27 UTC (rev 6370)
@@ -1,330 +1,330 @@
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
- <!--
- DiskStore configuration
+ <!--
+ DiskStore configuration
- Sets the path to the directory where cache files are created.
+ Sets the path to the directory where cache files are created.
- If the path is a Java System Property it is replaced by its value in the
- running VM.
+ If the path is a Java System Property it is replaced by its value in the
+ running VM.
- The following properties are translated:
- * user.home - User's home directory
- * user.dir - User's current working directory
- * java.io.tmpdir - Default temp file path
+ The following properties are translated:
+ * user.home - User's home directory
+ * user.dir - User's current working directory
+ * java.io.tmpdir - Default temp file path
- Subdirectories can be specified below the property e.g. java.io.tmpdir/one
- -->
- <diskStore path="java.io.tmpdir"/>
+ Subdirectories can be specified below the property e.g. java.io.tmpdir/one
+ -->
+ <diskStore path="java.io.tmpdir"/>
- <!--
- Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
- which is notified when Caches are added or removed from the CacheManager.
+ <!--
+ Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
+ which is notified when Caches are added or removed from the CacheManager.
- The attributes of CacheManagerEventListenerFactory are:
- * class - a fully qualified factory class name
- * properties - comma separated properties having meaning only to the factory.
+ The attributes of CacheManagerEventListenerFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the factory.
- Sets the fully qualified class name to be registered as the CacheManager event listener.
+ Sets the fully qualified class name to be registered as the CacheManager event listener.
- The events include:
- * adding a Cache
- * removing a Cache
+ The events include:
+ * adding a Cache
+ * removing a Cache
- Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
- of the implementer to safely handle the potential performance and thread safety issues
- depending on what their listener is doing.
+ Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
+ of the implementer to safely handle the potential performance and thread safety issues
+ depending on what their listener is doing.
- If no class is specified, no listener is created. There is no default.
- -->
- <cacheManagerEventListenerFactory class="" properties=""/>
+ If no class is specified, no listener is created. There is no default.
+ -->
+ <cacheManagerEventListenerFactory class="" properties=""/>
- <!--
- (Enable for distributed operation)
+ <!--
+ (Enable for distributed operation)
- Specifies a CacheManagerPeerProviderFactory which will be used to create a
- CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
+ Specifies a CacheManagerPeerProviderFactory which will be used to create a
+ CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
- The attributes of cacheManagerPeerProviderFactory are:
- * class - a fully qualified factory class name
- * properties - comma separated properties having meaning only to the factory.
+ The attributes of cacheManagerPeerProviderFactory are:
+ * class - a fully qualified factory class name
+ * properties - comma separated properties having meaning only to the factory.
- Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
- CacheManager peers participating in the cluster:
- * automatic, using a multicast group. This one automatically discovers peers and detects
- changes such as peers entering and leaving the group
- * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
- configuration time.
+ Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
+ CacheManager peers participating in the cluster:
+ * automatic, using a multicast group. This one automatically discovers peers and detects
+ changes such as peers entering and leaving the group
+ * manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
+ configuration time.
- Configuring Automatic Discovery:
- Automatic discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
- multicastGroupPort=4446, timeToLive=32"/>
+ Configuring Automatic Discovery:
+ Automatic discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
+ multicastGroupPort=4446, timeToLive=32"/>
- Valid properties are:
- * peerDiscovery (mandatory) - specify "automatic"
- * multicastGroupAddress (mandatory) - specify a valid multicast group address
- * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
- traffic
- * timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate.
- By convention, the restrictions are:
- 0 - the same host
- 1 - the same subnet
- 32 - the same site
- 64 - the same region
- 128 - the same continent
- 255 - unrestricted
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "automatic"
+ * multicastGroupAddress (mandatory) - specify a valid multicast group address
+ * multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
+ traffic
+ * timeToLive - specify a value between 0 and 255 which determines how far the packets will propagate.
+ By convention, the restrictions are:
+ 0 - the same host
+ 1 - the same subnet
+ 32 - the same site
+ 64 - the same region
+ 128 - the same continent
+ 255 - unrestricted
- Configuring Manual Discovery:
- Manual discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory class=
- "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=manual,
- rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
- | //server1:40000/sampleCache2|//server2:40000/sampleCache2"/>
+ Configuring Manual Discovery:
+ Manual discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=manual,
+ rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
+ | //server1:40000/sampleCache2|//server2:40000/sampleCache2"/>
- Valid properties are:
- * peerDiscovery (mandatory) - specify "manual"
- * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
- //hostname:port
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "manual"
+ * rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
+ //hostname:port
- The hostname is the hostname of the remote CacheManager peer. The port is the listening
- port of the RMICacheManagerPeerListener of the remote CacheManager peer.
+ The hostname is the hostname of the remote CacheManager peer. The port is the listening
+ port of the RMICacheManagerPeerListener of the remote CacheManager peer.
- An alternate CacheManagerPeerProviderFactory can be used for JNDI discovery of other
- CacheManagers in the cluster. Only manual discovery is supported.
+ An alternate CacheManagerPeerProviderFactory can be used for JNDI discovery of other
+ CacheManagers in the cluster. Only manual discovery is supported.
- For cacheManagerPeerProviderFactory specify class
- net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
+ For cacheManagerPeerProviderFactory specify class
+ net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
- Correspondingly for cacheManagerPeerListenerFactory specify class
- net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactoryory.
+ Correspondingly for cacheManagerPeerListenerFactory specify class
+ net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactoryory.
- Configuring JNDI Manual Discovery:
- Manual JNDI discovery is configured as per the following example:
- <cacheManagerPeerProviderFactory class=
- "net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory"
- properties="peerDiscovery=manual, stashContexts=true, stashRemoteCachePeers=true,
- jndiUrls=t3//server1:40000/sampleCache1|t3//server2:40000/sampleCache1
- |t3//server1:40000/sampleCache2|t3//server2:40000/sampleCache2"/>
+ Configuring JNDI Manual Discovery:
+ Manual JNDI discovery is configured as per the following example:
+ <cacheManagerPeerProviderFactory class=
+ "net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory"
+ properties="peerDiscovery=manual, stashContexts=true, stashRemoteCachePeers=true,
+ jndiUrls=t3//server1:40000/sampleCache1|t3//server2:40000/sampleCache1
+ |t3//server1:40000/sampleCache2|t3//server2:40000/sampleCache2"/>
- Valid properties are:
- * peerDiscovery (mandatory) - specify "manual"
- * stashContexts (optional) - specify "true" or "false". Defaults to true.
- java.naming.Context objects are stashed for performance.
- * stashRemoteCachePeers (optional) - specify "true" or "false". Defaults to true.
- CachePeer objects are stashed for performance.
- * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls,
- in the form protocol//hostname:port
- -->
- <cacheManagerPeerProviderFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
- properties="peerDiscovery=automatic,
+ Valid properties are:
+ * peerDiscovery (mandatory) - specify "manual"
+ * stashContexts (optional) - specify "true" or "false". Defaults to true.
+ java.naming.Context objects are stashed for performance.
+ * stashRemoteCachePeers (optional) - specify "true" or "false". Defaults to true.
+ CachePeer objects are stashed for performance.
+ * jndiUrls (mandatory) - specify a pipe separated list of jndiUrls,
+ in the form protocol//hostname:port
+ -->
+ <cacheManagerPeerProviderFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
+ properties="peerDiscovery=automatic,
multicastGroupAddress=228.1.2.3,
multicastGroupPort=48866, timeToLive=64"/>
- <!--
- (Enable for distributed operation)
+ <!--
+ (Enable for distributed operation)
- Specifies a CacheManagerPeerListenerFactory which will be used to create a
- CacheManagerPeerListener, which
- listens for messages from cache replicators participating in the cluster.
+ Specifies a CacheManagerPeerListenerFactory which will be used to create a
+ CacheManagerPeerListener, which
+ listens for messages from cache replicators participating in the cluster.
- The attributes of cacheManagerPeerListenerFactory are:
- class - a fully qualified factory class name
- properties - comma separated properties having meaning only to the factory.
+ The attributes of cacheManagerPeerListenerFactory are:
+ class - a fully qualified factory class name
+ properties - comma separated properties having meaning only to the factory.
- Ehcache comes with a built-in RMI-based distribution system. The listener component is
- RMICacheManagerPeerListener which is configured using
- RMICacheManagerPeerListenerFactory. It is configured as per the following example:
+ Ehcache comes with a built-in RMI-based distribution system. The listener component is
+ RMICacheManagerPeerListener which is configured using
+ RMICacheManagerPeerListenerFactory. It is configured as per the following example:
- <cacheManagerPeerListenerFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
- properties="hostName=fully_qualified_hostname_or_ip,
- port=40001,
- socketTimeoutMillis=120000"/>
+ <cacheManagerPeerListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
+ properties="hostName=fully_qualified_hostname_or_ip,
+ port=40001,
+ socketTimeoutMillis=120000"/>
- All properties are optional. They are:
- * hostName - the hostName of the host the listener is running on. Specify
- where the host is multihomed and you want to control the interface over which cluster
- messages are received. Defaults to the host name of the default interface if not
- specified.
- * port - the port the listener listens on. This defaults to a free port if not specified.
- * socketTimeoutMillis - the number of ms client sockets will stay open when sending
- messages to the listener. This should be long enough for the slowest message.
- If not specified it defaults 120000ms.
+ All properties are optional. They are:
+ * hostName - the hostName of the host the listener is running on. Specify
+ where the host is multihomed and you want to control the interface over which cluster
+ messages are received. Defaults to the host name of the default interface if not
+ specified.
+ * port - the port the listener listens on. This defaults to a free port if not specified.
+ * socketTimeoutMillis - the number of ms client sockets will stay open when sending
+ messages to the listener. This should be long enough for the slowest message.
+ If not specified it defaults 120000ms.
- An alternate CacheManagerPeerListenerFactory can be also be used for JNDI binding of
- listeners for messages from cache replicators participating in the cluster. For
- cacheManagerPeerListenerFactory specify
- class net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactory.
- Correspondingly for cacheManagerPeerProviderFactory specify class
- net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
- Properties for JNDIRMICacheManagerPeerListenerFactory are the same as
- RMICacheManagerPeerListenerFactory.
+ An alternate CacheManagerPeerListenerFactory can be also be used for JNDI binding of
+ listeners for messages from cache replicators participating in the cluster. For
+ cacheManagerPeerListenerFactory specify
+ class net.sf.ehcache.distribution.JNDIRMICacheManagerPeerListenerFactory.
+ Correspondingly for cacheManagerPeerProviderFactory specify class
+ net.sf.ehcache.distribution.JNDIManualRMICacheManagerPeerProviderFactoryerFactory.
+ Properties for JNDIRMICacheManagerPeerListenerFactory are the same as
+ RMICacheManagerPeerListenerFactory.
- -->
- <cacheManagerPeerListenerFactory
- class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
- properties="hostName=127.0.0.1, socketTimeoutMillis=120000"/>
+ -->
+ <cacheManagerPeerListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
+ properties="hostName=127.0.0.1, socketTimeoutMillis=120000"/>
- <!-- Cache configuration.
+ <!-- Cache configuration.
- The following attributes are required.
+ The following attributes are required.
- name:
- Sets the name of the cache. This is used to identify the cache. It must be unique.
+ name:
+ Sets the name of the cache. This is used to identify the cache. It must be unique.
- maxElementsInMemory:
- Sets the maximum number of objects that will be created in memory
+ maxElementsInMemory:
+ Sets the maximum number of objects that will be created in memory
- maxElementsOnDisk:
- Sets the maximum number of objects that will be maintained in the DiskStore
- The default value is zero, meaning unlimited.
+ maxElementsOnDisk:
+ Sets the maximum number of objects that will be maintained in the DiskStore
+ The default value is zero, meaning unlimited.
- eternal:
- Sets whether elements are eternal. If eternal, timeouts are ignored and the
- element is never expired.
+ eternal:
+ Sets whether elements are eternal. If eternal, timeouts are ignored and the
+ element is never expired.
- overflowToDisk:
- Sets whether elements can overflow to disk when the memory store
- has reached the maxInMemory limit.
+ overflowToDisk:
+ Sets whether elements can overflow to disk when the memory store
+ has reached the maxInMemory limit.
- The following attributes are optional.
+ The following attributes are optional.
- timeToIdleSeconds:
- Sets the time to idle for an element before it expires.
- i.e. The maximum amount of time between accesses before an element expires
- Is only used if the element is not eternal.
- Optional attribute. A value of 0 means that an Element can idle for infinity.
- The default value is 0.
+ timeToIdleSeconds:
+ Sets the time to idle for an element before it expires.
+ i.e. The maximum amount of time between accesses before an element expires
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that an Element can idle for infinity.
+ The default value is 0.
- timeToLiveSeconds:
- Sets the time to live for an element before it expires.
- i.e. The maximum time between creation time and when an element expires.
- Is only used if the element is not eternal.
- Optional attribute. A value of 0 means that and Element can live for infinity.
- The default value is 0.
+ timeToLiveSeconds:
+ Sets the time to live for an element before it expires.
+ i.e. The maximum time between creation time and when an element expires.
+ Is only used if the element is not eternal.
+ Optional attribute. A value of 0 means that and Element can live for infinity.
+ The default value is 0.
- diskPersistent:
- Whether the disk store persists between restarts of the Virtual Machine.
- The default value is false.
+ diskPersistent:
+ Whether the disk store persists between restarts of the Virtual Machine.
+ The default value is false.
- diskExpiryThreadIntervalSeconds:
- The number of seconds between runs of the disk expiry thread. The default value
- is 120 seconds.
+ diskExpiryThreadIntervalSeconds:
+ The number of seconds between runs of the disk expiry thread. The default value
+ is 120 seconds.
- memoryStoreEvictionPolicy:
- Policy would be enforced upon reaching the maxElementsInMemory limit. Default
- policy is Least Recently Used (specified as LRU). Other policies available -
- First In First Out (specified as FIFO) and Less Frequently Used
- (specified as LFU)
+ memoryStoreEvictionPolicy:
+ Policy would be enforced upon reaching the maxElementsInMemory limit. Default
+ policy is Least Recently Used (specified as LRU). Other policies available -
+ First In First Out (specified as FIFO) and Less Frequently Used
+ (specified as LFU)
- Cache elements can also contain sub elements which take the same format of a factory class
- and properties. Defined sub-elements are:
+ Cache elements can also contain sub elements which take the same format of a factory class
+ and properties. Defined sub-elements are:
- * cacheEventListenerFactory - Enables registration of listeners for cache events, such as
- put, remove, update, and expire.
+ * cacheEventListenerFactory - Enables registration of listeners for cache events, such as
+ put, remove, update, and expire.
- * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
- cache on initialisation to prepopulate itself.
+ * bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
+ cache on initialisation to prepopulate itself.
- Each cache that will be distributed needs to set a cache event listener which replicates
- messages to the other CacheManager peers. For the built-in RMI implementation this is done
- by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
- distributed cache's configuration as per the following example:
+ Each cache that will be distributed needs to set a cache event listener which replicates
+ messages to the other CacheManager peers. For the built-in RMI implementation this is done
+ by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
+ distributed cache's configuration as per the following example:
- <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
- properties="replicateAsynchronously=true,
- replicatePuts=true,
- replicateUpdates=true,
- replicateUpdatesViaCopy=true,
- replicateRemovals=true "/>
+ <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=true,
+ replicatePuts=true,
+ replicateUpdates=true,
+ replicateUpdatesViaCopy=true,
+ replicateRemovals=true "/>
- The RMICacheReplicatorFactory recognises the following properties:
+ The RMICacheReplicatorFactory recognises the following properties:
- * replicatePuts=true|false - whether new elements placed in a cache are
- replicated to others. Defaults to true.
+ * replicatePuts=true|false - whether new elements placed in a cache are
+ replicated to others. Defaults to true.
- * replicateUpdates=true|false - whether new elements which override an
- element already existing with the same key are replicated. Defaults to true.
+ * replicateUpdates=true|false - whether new elements which override an
+ element already existing with the same key are replicated. Defaults to true.
- * replicateRemovals=true - whether element removals are replicated. Defaults to true.
+ * replicateRemovals=true - whether element removals are replicated. Defaults to true.
- * replicateAsynchronously=true | false - whether replications are
- asynchronous (true) or synchronous (false). Defaults to true.
+ * replicateAsynchronously=true | false - whether replications are
+ asynchronous (true) or synchronous (false). Defaults to true.
- * replicateUpdatesViaCopy=true | false - whether the new elements are
- copied to other caches (true), or whether a remove message is sent. Defaults to true.
+ * replicateUpdatesViaCopy=true | false - whether the new elements are
+ copied to other caches (true), or whether a remove message is sent. Defaults to true.
- * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
- replicator runs at a set interval of milliseconds. The default is 1000. The minimum
- is 10. This property is only applicable if replicateAsynchronously=true
+ * asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
+ replicator runs at a set interval of milliseconds. The default is 1000. The minimum
+ is 10. This property is only applicable if replicateAsynchronously=true
- The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
- used. It is configured as per the following example:
+ The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
+ used. It is configured as per the following example:
- <bootstrapCacheLoaderFactory
- class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
- properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>
+ <bootstrapCacheLoaderFactory
+ class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
+ properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"/>
- The RMIBootstrapCacheLoaderFactory recognises the following optional properties:
+ The RMIBootstrapCacheLoaderFactory recognises the following optional properties:
- * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
- after the cache has started. If false, bootstrapping must complete before the cache is
- made available. The default value is true.
+ * bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
+ after the cache has started. If false, bootstrapping must complete before the cache is
+ made available. The default value is true.
- * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
- memory limits of the VM. This property allows the bootstraper to fetched elements in
- chunks. The default chunk size is 5000000 (5MB).
+ * maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
+ memory limits of the VM. This property allows the bootstraper to fetched elements in
+ chunks. The default chunk size is 5000000 (5MB).
- -->
+ -->
- <!--
- Mandatory Default Cache configuration. These settings will be applied to caches
- created programmtically using CacheManager.add(String cacheName)
- -->
- <defaultCache
- maxElementsInMemory="10000"
- eternal="false"
- timeToIdleSeconds="120"
- timeToLiveSeconds="120"
- overflowToDisk="true"
- maxElementsOnDisk="10000000"
- diskPersistent="false"
- diskExpiryThreadIntervalSeconds="120"
- memoryStoreEvictionPolicy="LRU"
- />
+ <!--
+ Mandatory Default Cache configuration. These settings will be applied to caches
+ created programmtically using CacheManager.add(String cacheName)
+ -->
+ <defaultCache
+ maxElementsInMemory="1000000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="true"
+ maxElementsOnDisk="10000000"
+ diskPersistent="false"
+ diskExpiryThreadIntervalSeconds="120"
+ memoryStoreEvictionPolicy="LRU"
+ />
- <!--
- Sample caches. Following are some example caches. Remove these before use.
- -->
+ <!--
+ Sample caches. Following are some example caches. Remove these before use.
+ -->
<!--
NOTE that the cache benchmarking fwk looks for a cache named "cache".
-->
- <!--
- Sample distributed cache named sampleDistributedCache2.
- This cache replicates using specific properties.
- It only replicates updates and does so synchronously via copy
- -->
- <cache name="cache"
- maxElementsInMemory="10000"
- eternal="false"
- timeToIdleSeconds="100"
- timeToLiveSeconds="100"
- overflowToDisk="false">
- <cacheEventListenerFactory
- class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
- properties="replicateAsynchronously=false, replicatePuts=true,
+ <!--
+ Sample distributed cache named sampleDistributedCache2.
+ This cache replicates using specific properties.
+ It only replicates updates and does so synchronously via copy
+ -->
+ <cache name="cache"
+ maxElementsInMemory="1000000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="false">
+ <cacheEventListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=false, replicatePuts=true,
replicateUpdates=true, replicateUpdatesViaCopy=true,
replicateRemovals=true"/>
- </cache>
+ </cache>
</ehcache>
Modified: benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/lib/jbosscache-core.jar
===================================================================
(Binary files differ)
Modified: benchmarks/benchmark-fwk/trunk/conf/log4j.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/conf/log4j.xml 2008-07-23 01:17:14 UTC (rev 6369)
+++ benchmarks/benchmark-fwk/trunk/conf/log4j.xml 2008-07-23 01:25:27 UTC (rev 6370)
@@ -5,7 +5,8 @@
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- The list of appenders -->
<!-- The rolling file appender -->
- <appender name="FILE" class="org.cachebench.utils.PerNodeRollingFileAppender">
+ <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+ <!--<appender name="FILE" class="org.cachebench.utils.PerNodeRollingFileAppender">-->
<param name="File" value="cachebench.log"/>
<param name="Append" value="true"/>
<param name="Threshold" value="TRACE"/>
@@ -66,7 +67,7 @@
<!-- Here goes the root -->
<root>
<priority value="INFO"/>
- <appender-ref ref="FILE" />
+ <appender-ref ref="FILE"/>
</root>
</log4j:configuration>
15 years, 10 months