JBoss Cache SVN: r7774 - core/trunk/src/main/java/org/jboss/cache.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-02-24 10:42:55 -0500 (Tue, 24 Feb 2009)
New Revision: 7774
Modified:
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
Log:
Better sanity check
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2009-02-24 15:26:32 UTC (rev 7773)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2009-02-24 15:42:55 UTC (rev 7774)
@@ -63,6 +63,7 @@
import org.jgroups.blocks.GroupRequest;
import org.jgroups.blocks.RspFilter;
import org.jgroups.protocols.TP;
+import org.jgroups.protocols.pbcast.STREAMING_STATE_TRANSFER;
import org.jgroups.stack.ProtocolStack;
import org.jgroups.util.Rsp;
import org.jgroups.util.RspList;
@@ -321,7 +322,7 @@
sanityCheckConfiguration(nonBlocking, fetchState);
this.flushTracker = nonBlocking ? new NonBlockingFlushTracker() : new StandardFlushTracker();
- initialiseChannelAndRpcDispatcher(fetchState && !nonBlocking);
+ initialiseChannelAndRpcDispatcher(fetchState && !nonBlocking, nonBlocking);
if (!fetchState || nonBlocking)
{
@@ -387,10 +388,6 @@
if (isUsingBuddyReplication)
throw new ConfigurationException("Non-blocking state transfer cannot be used with buddy replication at this time. Please disable either buddy replication or non-blocking state transfer.");
-
- // Make sure Streaming state transfer is enabled in JGroups!
- if (!configuration.getClusterConfig().contains("STREAMING_STATE_TRANSFER"))
- throw new ConfigurationException("Non-blocking state transfer requires the STREAMING_STATE_TRANSFER protocol in JGroups. Please make sure this is available, or else disable non-blocking state transfer.");
}
private void startNonBlockStateTransfer(List<Address> members)
@@ -501,7 +498,7 @@
}
@SuppressWarnings("deprecation")
- private void initialiseChannelAndRpcDispatcher(boolean fetchState) throws CacheException
+ private void initialiseChannelAndRpcDispatcher(boolean fetchStateWithoutNBST, boolean nbst) throws CacheException
{
channel = configuration.getRuntimeConfig().getChannel();
if (channel == null)
@@ -545,11 +542,15 @@
configuration.getRuntimeConfig().setChannel(channel);
}
+
+ if (nbst && ((JChannel) channel).getProtocolStack().findProtocol(STREAMING_STATE_TRANSFER.class) == null)
+ throw new ConfigurationException("JGroups channel does not use STREAMING_STATE_TRANSFER! This is a requirement for non-blocking state transfer. Either make sure your JGroups configuration uses STREAMING_STATE_TRANSFER or disable non-blocking state transfer.");
+
// Channel.LOCAL *must* be set to false so we don't see our own messages - otherwise invalidations targeted at
// remote instances will be received by self.
channel.setOpt(Channel.LOCAL, false);
channel.setOpt(Channel.AUTO_RECONNECT, true);
- channel.setOpt(Channel.AUTO_GETSTATE, fetchState);
+ channel.setOpt(Channel.AUTO_GETSTATE, fetchStateWithoutNBST);
channel.setOpt(Channel.BLOCK, true);
if (configuration.isUseRegionBasedMarshalling())
14 years, 3 months
JBoss Cache SVN: r7773 - core/trunk/src/main/java/org/jboss/cache.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-02-24 10:26:32 -0500 (Tue, 24 Feb 2009)
New Revision: 7773
Modified:
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
Log:
Better sanity check
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2009-02-24 14:20:30 UTC (rev 7772)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2009-02-24 15:26:32 UTC (rev 7773)
@@ -387,6 +387,10 @@
if (isUsingBuddyReplication)
throw new ConfigurationException("Non-blocking state transfer cannot be used with buddy replication at this time. Please disable either buddy replication or non-blocking state transfer.");
+
+ // Make sure Streaming state transfer is enabled in JGroups!
+ if (!configuration.getClusterConfig().contains("STREAMING_STATE_TRANSFER"))
+ throw new ConfigurationException("Non-blocking state transfer requires the STREAMING_STATE_TRANSFER protocol in JGroups. Please make sure this is available, or else disable non-blocking state transfer.");
}
private void startNonBlockStateTransfer(List<Address> members)
14 years, 3 months
JBoss Cache SVN: r7772 - in core/trunk/src/main/java/org/jboss/cache: statetransfer and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-02-24 09:20:30 -0500 (Tue, 24 Feb 2009)
New Revision: 7772
Modified:
core/trunk/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java
core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java
Log:
More verbose logging
Modified: core/trunk/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java 2009-02-24 14:03:13 UTC (rev 7771)
+++ core/trunk/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java 2009-02-24 14:20:30 UTC (rev 7772)
@@ -181,6 +181,7 @@
log.debug("transferred state is null (may be first member in cluster)");
return;
}
+ if (trace) log.trace("setState() called with byte array of size " + new_state.length);
ByteArrayInputStream bais = new ByteArrayInputStream(new_state);
MarshalledValueInputStream in = null;
try
@@ -287,6 +288,7 @@
log.debug("stream is null (may be first member in cluster)");
return;
}
+ if (trace) log.trace("setState() called with input stream");
MarshalledValueInputStream in = null;
try
{
@@ -311,12 +313,12 @@
public void setState(String state_id, byte[] state)
{
- if (trace) log.trace("Receiving state for " + state_id);
if (state == null)
{
- log.debug("partial transferred state is null");
+ log.debug("partial transferred state for id "+state_id+ " is null");
return;
}
+ if (trace) log.trace("Receiving state byte array of length " +state.length+" for " + state_id);
MarshalledValueInputStream in = null;
String targetRoot = state_id;
@@ -359,7 +361,7 @@
public void setState(String stateId, InputStream istream)
{
- if (trace) log.trace("Receiving state for " + stateId);
+ if (trace) log.trace("Receiving state on stream for " + stateId);
String targetRoot = stateId;
MarshalledValueInputStream in = null;
boolean hasDifferentSourceAndIntegrationRoots = stateId.indexOf(DefaultStateTransferManager.PARTIAL_STATE_DELIMITER) > 0;
Modified: core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java 2009-02-24 14:03:13 UTC (rev 7771)
+++ core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java 2009-02-24 14:20:30 UTC (rev 7772)
@@ -140,6 +140,7 @@
public void setState(ObjectInputStream in, Fqn targetRoot) throws Exception
{
+ if (trace) log.trace("Setting state on Fqn root " + targetRoot);
cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
NodeSPI target = cache.getNode(targetRoot);
if (target == null)
14 years, 3 months
JBoss Cache SVN: r7771 - in core/trunk/src/main/java/org/jboss/cache: statetransfer and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-02-24 09:03:13 -0500 (Tue, 24 Feb 2009)
New Revision: 7771
Modified:
core/trunk/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java
core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
Log:
More verbose logging
Modified: core/trunk/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java 2009-02-24 13:45:44 UTC (rev 7770)
+++ core/trunk/src/main/java/org/jboss/cache/remoting/jgroups/ChannelMessageListener.java 2009-02-24 14:03:13 UTC (rev 7771)
@@ -115,7 +115,7 @@
{
if (t instanceof CacheException)
{
- log.debug(t);
+ log.debug("Caught exception integrating state!", t);
}
else
{
@@ -135,7 +135,7 @@
{
if (t instanceof CacheException)
{
- log.debug(t);
+ log.debug("Caught exception generating state!", t);
}
else
{
Modified: core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2009-02-24 13:45:44 UTC (rev 7770)
+++ core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java 2009-02-24 14:03:13 UTC (rev 7771)
@@ -21,12 +21,6 @@
*/
package org.jboss.cache.statetransfer;
-import java.io.ObjectOutputStream;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
@@ -35,8 +29,8 @@
import org.jboss.cache.InternalNode;
import org.jboss.cache.Node;
import org.jboss.cache.RPCManager;
-import org.jboss.cache.Version;
import org.jboss.cache.RPCManagerImpl.FlushTracker;
+import org.jboss.cache.Version;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
@@ -45,12 +39,19 @@
import org.jboss.cache.marshall.NodeDataExceptionMarker;
import org.jboss.cache.transaction.TransactionLog;
+import java.io.ObjectOutputStream;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
public class DefaultStateTransferGenerator implements StateTransferGenerator
{
public static final short STATE_TRANSFER_VERSION = Version.getVersionShort("2.0.0.GA");
- private Log log = LogFactory.getLog(getClass().getName());
+ private static final Log log = LogFactory.getLog(DefaultStateTransferGenerator.class);
+ private static final boolean trace = log.isTraceEnabled();
private CacheSPI cache;
private RPCManager rpcManager;
@@ -98,36 +99,21 @@
if (! activated)
throw new CacheException("Busy performing state transfer for someone else");
- if (log.isTraceEnabled())
- log.trace("Transaction log activated!");
-
+ if (trace) log.trace("Transaction log activated!");
}
//transient + marker
- if (log.isTraceEnabled())
- {
- log.trace("writing transient state for " + fqn);
- }
+ if (trace) log.trace("writing transient state for " + fqn);
marshallTransientState((InternalNode) rootNode, out);
- if (log.isTraceEnabled())
- {
- log.trace("transient state succesfully written");
- }
+ if (trace) log.trace("transient state succesfully written");
//associated + marker
- if (log.isTraceEnabled())
- {
- log.trace("writing associated state");
- }
+ if (trace) log.trace("writing associated state");
delimitStream(out);
- if (log.isTraceEnabled())
- {
- log.trace("associated state succesfully written");
- }
-
+ if (trace) log.trace("associated state succesfully written");
}
else
{
@@ -163,10 +149,7 @@
private void writePersistentData(ObjectOutputStream out, Fqn fqn, CacheLoader cacheLoader) throws Exception
{
- if (log.isTraceEnabled())
- {
- log.trace("writing persistent state for " + fqn + ",using " + cache.getCacheLoaderManager().getCacheLoader().getClass());
- }
+ if (trace) log.trace("writing persistent state for " + fqn + ", using " + cache.getCacheLoaderManager().getCacheLoader().getClass());
if (fqn.isRoot())
{
@@ -177,10 +160,7 @@
cacheLoader.loadState(fqn, out);
}
- if (log.isTraceEnabled())
- {
- log.trace("persistent state succesfully written");
- }
+ if (trace) log.trace("persistent state succesfully written");
}
private void writeTxLog(ObjectOutputStream out) throws Exception
@@ -189,10 +169,10 @@
try
{
+ if (trace) log.trace("Transaction log size is " + txLog.size());
for (int nonProgress = 0, size = txLog.size(); size > 0;)
{
- if (log.isTraceEnabled())
- log.trace("Tx Log remaining entries = " + size);
+ if (trace) log.trace("Tx Log remaining entries = " + size);
txLog.writeCommitLog(cache.getMarshaller(), out);
int newSize = txLog.size();
@@ -212,8 +192,9 @@
// of the remaining transactions.
delimitStream(out);
out.flush();
+ if (trace) log.trace("Waiting for a FLUSH");
flushTracker.waitForFlushStart(flushTimeout);
-
+ if (trace) log.trace("FLUSH received, proceeding with writing commit log");
// Write remaining transactions
txLog.writeCommitLog(cache.getMarshaller(), out);
delimitStream(out);
14 years, 3 months
JBoss Cache SVN: r7770 - in core/trunk/src/main/java/org/jboss/cache: config and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-02-24 08:45:44 -0500 (Tue, 24 Feb 2009)
New Revision: 7770
Modified:
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
Log:
Configuration sanity check for NBST configs
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2009-02-24 13:34:08 UTC (rev 7769)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2009-02-24 13:45:44 UTC (rev 7770)
@@ -26,6 +26,7 @@
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.config.RuntimeConfig;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.factories.annotations.Inject;
@@ -316,6 +317,9 @@
boolean fetchState = shouldFetchStateOnStartup();
boolean nonBlocking = configuration.isNonBlockingStateTransfer();
+
+ sanityCheckConfiguration(nonBlocking, fetchState);
+
this.flushTracker = nonBlocking ? new NonBlockingFlushTracker() : new StandardFlushTracker();
initialiseChannelAndRpcDispatcher(fetchState && !nonBlocking);
@@ -374,6 +378,17 @@
}
}
+ private void sanityCheckConfiguration(boolean nonBlockingStateTransfer, boolean fetchStateOnStart)
+ {
+ if (isInLocalMode || !nonBlockingStateTransfer || !fetchStateOnStart) return; // don't care about these cases!
+
+ if (configuration.getNodeLockingScheme() != NodeLockingScheme.MVCC)
+ throw new ConfigurationException("Non-blocking state transfer is only supported with the MVCC node locking scheme. Please change your node locking scheme to MVCC or disable non-blocking state transfer.");
+
+ if (isUsingBuddyReplication)
+ throw new ConfigurationException("Non-blocking state transfer cannot be used with buddy replication at this time. Please disable either buddy replication or non-blocking state transfer.");
+ }
+
private void startNonBlockStateTransfer(List<Address> members)
{
Modified: core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2009-02-24 13:34:08 UTC (rev 7769)
+++ core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2009-02-24 13:45:44 UTC (rev 7770)
@@ -548,6 +548,7 @@
}
}
+ @Deprecated
public String getNodeLockingSchemeString()
{
return nodeLockingScheme == null ? null : nodeLockingScheme.toString();
14 years, 3 months
JBoss Cache SVN: r7769 - in core/trunk/src: main/java/org/jboss/cache/config/parsing and 6 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-02-24 08:34:08 -0500 (Tue, 24 Feb 2009)
New Revision: 7769
Added:
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/JGroupsStackParser.java
core/trunk/src/main/resources/schema/jbosscache-config-3.0.xsd
core/trunk/src/main/resources/schema/jbosscache-registry-3.0.xsd
core/trunk/src/test/java/org/jboss/cache/config/parsing/ParseFileWith30SchemaTest.java
core/trunk/src/test/resources/configs/incorrect-3_0-config-file.xml
core/trunk/src/test/resources/configs/simple-3_0-config-file.xml
Removed:
core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java
Modified:
core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/RootElementBuilder.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlParserBase.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/BuddyElementParser.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/CustomInterceptorsElementParser.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/EvictionElementParser.java
core/trunk/src/main/java/org/jboss/cache/config/parsing/element/LoadersElementParser.java
core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/CacheLoadersElementParserTest.java
core/trunk/src/test/java/org/jboss/cache/config/parsing/JGroupsStackParserTest.java
core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
Log:
Configuration compatibility with JBC 3.0
Modified: core/trunk/src/main/java/org/jboss/cache/config/Configuration.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/main/java/org/jboss/cache/config/Configuration.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -23,7 +23,7 @@
import org.jboss.cache.Version;
import org.jboss.cache.buddyreplication.BuddyManager;
-import org.jboss.cache.config.parsing.JGroupsStackParser;
+import org.jboss.cache.config.parsing.element.JGroupsStackParser;
import org.jboss.cache.factories.annotations.NonVolatile;
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.lock.IsolationLevel;
Deleted: core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -1,107 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.config.parsing;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.NodeList;
-
-/**
- * The purpose of this class is to parse the jgroups configuration from the config file into an compact string
- * that can be passed as a config to the channel.
- *
- * @author Mircea.Markus(a)jboss.com
- * @since 3.0
- */
-public class JGroupsStackParser
-{
- /**
- * Parses the cluster config which is used to start a JGroups channel
- *
- * @param config an old-style JGroups protocol config String
- */
- public String parseClusterConfigXml(Element config)
- {
- StringBuilder buffer = new StringBuilder();
- NodeList stack = config.getChildNodes();
- int length = stack.getLength();
-
- for (int s = 0; s < length; s++)
- {
- org.w3c.dom.Node node = stack.item(s);
- if (node.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE)
- {
- continue;
- }
-
- // Ignore Namespace until JGroups defines one
- Element tag = (Element) node;
- String protocol = tag.getLocalName();
- if (protocol == null)
- {
- protocol = tag.getNodeName(); // try a non-namespace aware version
- }
- buffer.append(protocol);
- processAttributes(buffer, tag);
- buffer.append(':');
- }
- if (buffer.length() > 0)
- {
- //Remove the trailing ':'
- buffer.setLength(buffer.length() - 1);
- }
- return buffer.toString();
- }
-
- private void processAttributes(StringBuilder buffer, Element tag)
- {
- NamedNodeMap attrs = tag.getAttributes();
- int attrLength = attrs.getLength();
- if (attrLength > 0)
- {
- buffer.append('(');
- }
- for (int a = 0; a < attrLength; a++)
- {
- Attr attr = (Attr) attrs.item(a);
- processSingleAttribute(buffer, attr);
- if (a < attrLength - 1)
- {
- buffer.append(';');
- }
- }
- if (attrLength > 0)
- {
- buffer.append(')');
- }
- }
-
- private void processSingleAttribute(StringBuilder buffer, Attr attr)
- {
- String name = attr.getName();
- String value = attr.getValue();
- buffer.append(name);
- buffer.append('=');
- buffer.append(value);
- }
-}
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/RootElementBuilder.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/RootElementBuilder.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/RootElementBuilder.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -36,7 +36,7 @@
import java.io.InputStream;
/**
- * Parses an xml files and validates xml elements form {@link RootElementBuilder#JBOSSCACHE_CORE_NS} namespace
+ * Parses an xml files and validates xml elements form {@link RootElementBuilder#JBOSSCACHE_CORE_NS_31} namespace
* according to the configured schema.
*
* @author Mircea.Markus(a)jboss.com
@@ -47,14 +47,18 @@
private static final JBossEntityResolver resolver = new JBossEntityResolver();
- public static final String JBOSSCACHE_CORE_NS = "urn:jboss:jbosscache-core:config:3.1";
- public static final String JBOSSCACHE_REPO_NS = "urn:jboss:jbosscache-core:cache-repo:3.1";
+ public static final String JBOSSCACHE_CORE_NS_31 = "urn:jboss:jbosscache-core:config:3.1";
+ public static final String JBOSSCACHE_REPO_NS_31 = "urn:jboss:jbosscache-core:cache-repo:3.1";
+ public static final String JBOSSCACHE_CORE_NS_30 = "urn:jboss:jbosscache-core:config:3.0";
+ public static final String JBOSSCACHE_REPO_NS_30 = "urn:jboss:jbosscache-core:cache-repo:3.0";
static
{
// Globally register this namespace
- JBossEntityResolver.registerEntity(JBOSSCACHE_CORE_NS, "jbosscache-config-3.1.xsd");
- JBossEntityResolver.registerEntity(JBOSSCACHE_REPO_NS, "jbosscache-registry-3.1.xsd");
+ JBossEntityResolver.registerEntity(JBOSSCACHE_CORE_NS_31, "jbosscache-config-3.1.xsd");
+ JBossEntityResolver.registerEntity(JBOSSCACHE_REPO_NS_31, "jbosscache-registry-3.1.xsd");
+ JBossEntityResolver.registerEntity(JBOSSCACHE_CORE_NS_30, "jbosscache-config-3.0.xsd");
+ JBossEntityResolver.registerEntity(JBOSSCACHE_REPO_NS_30, "jbosscache-registry-3.0.xsd");
}
private static final Log log = LogFactory.getLog(RootElementBuilder.class);
@@ -83,7 +87,7 @@
{
this(new FailureErrorHandler(), validating);
}
-
+
public Element readRoot(InputStream config)
{
try
@@ -94,8 +98,8 @@
{
docBuilderFactory.setValidating(true);
docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
- String[] value = {JBOSSCACHE_CORE_NS, JBOSSCACHE_REPO_NS};
- docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", value);
+ docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",
+ new String[]{JBOSSCACHE_CORE_NS_30, JBOSSCACHE_CORE_NS_31, JBOSSCACHE_REPO_NS_30, JBOSSCACHE_REPO_NS_31});
}
DocumentBuilder parser = docBuilderFactory.newDocumentBuilder();
parser.setEntityResolver(resolver);
@@ -107,8 +111,7 @@
}
catch (Exception e)
{
- log.error(e);
- throw new ConfigurationException("Could not parse the config file");
+ throw new ConfigurationException("Could not parse the config file", e);
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -391,7 +391,7 @@
*/
public static Element stringToElementInCoreNS(String xml) throws Exception
{
- xml = "<wrapper xmlns='" + RootElementBuilder.JBOSSCACHE_CORE_NS + "'>" + xml + "</wrapper>";
+ xml = "<wrapper xmlns='" + RootElementBuilder.JBOSSCACHE_CORE_NS_31 + "'>" + xml + "</wrapper>";
ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("utf8"));
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -31,6 +31,7 @@
import org.jboss.cache.config.parsing.element.CustomInterceptorsElementParser;
import org.jboss.cache.config.parsing.element.EvictionElementParser;
import org.jboss.cache.config.parsing.element.LoadersElementParser;
+import org.jboss.cache.config.parsing.element.JGroupsStackParser;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.util.FileLookup;
import org.w3c.dom.Element;
@@ -142,10 +143,17 @@
private Configuration processElements(boolean ignoreRoot)
{
+ coreNamespace = root.getNamespaceURI();
+ if (coreNamespace == null) coreNamespace = RootElementBuilder.JBOSSCACHE_CORE_NS_31; // use the default
+
if (!ignoreRoot &&
- (!"jbosscache".equals(root.getLocalName()) || !RootElementBuilder.JBOSSCACHE_CORE_NS.equals(root.getNamespaceURI())))
+ (!"jbosscache".equals(root.getLocalName()) ||
+ (!RootElementBuilder.JBOSSCACHE_CORE_NS_31.equals(coreNamespace) &&
+ !RootElementBuilder.JBOSSCACHE_CORE_NS_30.equals(coreNamespace))
+ ))
{
- throw new ConfigurationException("Expected root element {" + RootElementBuilder.JBOSSCACHE_CORE_NS + "}" + "jbosscache");
+ throw new ConfigurationException("Expected root element <jbosscache />" + (isValidating() ? " in either {" +
+ RootElementBuilder.JBOSSCACHE_CORE_NS_30 + "} or {" + RootElementBuilder.JBOSSCACHE_CORE_NS_31 + "} namespaces" : ""));
}
try
@@ -249,7 +257,7 @@
private void configureCustomInterceptors(Element element)
{
if (element == null) return; //this element might be missing
- CustomInterceptorsElementParser parser = new CustomInterceptorsElementParser();
+ CustomInterceptorsElementParser parser = new CustomInterceptorsElementParser(coreNamespace);
List<CustomInterceptorConfig> interceptorConfigList = parser.parseCustomInterceptors(element);
config.setCustomInterceptors(interceptorConfigList);
}
@@ -274,7 +282,7 @@
private void configureBuddyReplication(Element element)
{
if (element == null) return;//buddy config might not exist, expect that
- BuddyElementParser buddyElementParser = new BuddyElementParser();
+ BuddyElementParser buddyElementParser = new BuddyElementParser(coreNamespace);
BuddyReplicationConfig brConfig = buddyElementParser.parseBuddyElement(element);
config.setBuddyReplicationConfig(brConfig);
}
@@ -282,7 +290,7 @@
private void configureCacheLoaders(Element element)
{
if (element == null) return; //null cache loaders are allowed
- LoadersElementParser clElementParser = new LoadersElementParser();
+ LoadersElementParser clElementParser = new LoadersElementParser(coreNamespace);
CacheLoaderConfig cacheLoaderConfig = clElementParser.parseLoadersElement(element);
config.setCacheLoaderConfig(cacheLoaderConfig);
}
@@ -290,7 +298,7 @@
private void configureEviction(Element element)
{
if (element == null) return; //no eviction might be configured
- EvictionElementParser evictionElementParser = new EvictionElementParser();
+ EvictionElementParser evictionElementParser = new EvictionElementParser(coreNamespace);
config.setEvictionConfig(evictionElementParser.parseEvictionElement(element));
}
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlParserBase.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlParserBase.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlParserBase.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -34,6 +34,7 @@
*/
public abstract class XmlParserBase
{
+ protected String coreNamespace;
/**
* @see Integer#parseInt(String)
*/
@@ -84,7 +85,7 @@
*/
protected Element getSingleElementInCoreNS(String elementName, Element parent)
{
- return getSingleElement(RootElementBuilder.JBOSSCACHE_CORE_NS, elementName, parent);
+ return getSingleElement(coreNamespace, elementName, parent);
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/element/BuddyElementParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/element/BuddyElementParser.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/BuddyElementParser.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -25,6 +25,7 @@
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.parsing.XmlParserBase;
+import org.jboss.cache.config.parsing.RootElementBuilder;
import org.w3c.dom.Element;
import java.util.Properties;
@@ -41,6 +42,16 @@
*/
public class BuddyElementParser extends XmlParserBase
{
+ public BuddyElementParser()
+ {
+ this(RootElementBuilder.JBOSSCACHE_CORE_NS_31);
+ }
+
+ public BuddyElementParser(String coreNamespace)
+ {
+ this.coreNamespace = coreNamespace;
+ }
+
public BuddyReplicationConfig parseBuddyElement(Element element)
{
assertNotLegacyElement(element);
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/element/CustomInterceptorsElementParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/element/CustomInterceptorsElementParser.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/CustomInterceptorsElementParser.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -25,6 +25,7 @@
import org.jboss.cache.config.CustomInterceptorConfig;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.parsing.XmlParserBase;
+import org.jboss.cache.config.parsing.RootElementBuilder;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.util.Util;
import org.w3c.dom.Element;
@@ -46,6 +47,16 @@
*/
public class CustomInterceptorsElementParser extends XmlParserBase
{
+ public CustomInterceptorsElementParser()
+ {
+ this(RootElementBuilder.JBOSSCACHE_CORE_NS_31);
+ }
+
+ public CustomInterceptorsElementParser(String coreNamespace)
+ {
+ this.coreNamespace = coreNamespace;
+ }
+
/**
* Iterates within the given element looking for custom interceptors.
*
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/element/EvictionElementParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/element/EvictionElementParser.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/EvictionElementParser.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -28,6 +28,7 @@
import org.jboss.cache.config.MissingPolicyException;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.parsing.XmlParserBase;
+import org.jboss.cache.config.parsing.RootElementBuilder;
import org.jboss.cache.eviction.EvictionAlgorithm;
import org.jboss.cache.util.Util;
import org.w3c.dom.Element;
@@ -49,6 +50,16 @@
*/
public class EvictionElementParser extends XmlParserBase
{
+ public EvictionElementParser()
+ {
+ this(RootElementBuilder.JBOSSCACHE_CORE_NS_31);
+ }
+
+ public EvictionElementParser(String coreNamespace)
+ {
+ this.coreNamespace = coreNamespace;
+ }
+
public EvictionConfig parseEvictionElement(Element evictionElement)
{
assertNotLegacyElement(evictionElement);
Copied: core/trunk/src/main/java/org/jboss/cache/config/parsing/element/JGroupsStackParser.java (from rev 7766, core/trunk/src/main/java/org/jboss/cache/config/parsing/JGroupsStackParser.java)
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/element/JGroupsStackParser.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/JGroupsStackParser.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.config.parsing.element;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+
+/**
+ * The purpose of this class is to parse the jgroups configuration from the config file into an compact string
+ * that can be passed as a config to the channel.
+ *
+ * @author Mircea.Markus(a)jboss.com
+ * @since 3.0
+ */
+public class JGroupsStackParser
+{
+ /**
+ * Parses the cluster config which is used to start a JGroups channel
+ *
+ * @param config an old-style JGroups protocol config String
+ */
+ public String parseClusterConfigXml(Element config)
+ {
+ StringBuilder buffer = new StringBuilder();
+ NodeList stack = config.getChildNodes();
+ int length = stack.getLength();
+
+ for (int s = 0; s < length; s++)
+ {
+ org.w3c.dom.Node node = stack.item(s);
+ if (node.getNodeType() != org.w3c.dom.Node.ELEMENT_NODE)
+ {
+ continue;
+ }
+
+ // Ignore Namespace until JGroups defines one
+ Element tag = (Element) node;
+ String protocol = tag.getLocalName();
+ if (protocol == null)
+ {
+ protocol = tag.getNodeName(); // try a non-namespace aware version
+ }
+ buffer.append(protocol);
+ processAttributes(buffer, tag);
+ buffer.append(':');
+ }
+ if (buffer.length() > 0)
+ {
+ //Remove the trailing ':'
+ buffer.setLength(buffer.length() - 1);
+ }
+ return buffer.toString();
+ }
+
+ private void processAttributes(StringBuilder buffer, Element tag)
+ {
+ NamedNodeMap attrs = tag.getAttributes();
+ int attrLength = attrs.getLength();
+ if (attrLength > 0)
+ {
+ buffer.append('(');
+ }
+ for (int a = 0; a < attrLength; a++)
+ {
+ Attr attr = (Attr) attrs.item(a);
+ processSingleAttribute(buffer, attr);
+ if (a < attrLength - 1)
+ {
+ buffer.append(';');
+ }
+ }
+ if (attrLength > 0)
+ {
+ buffer.append(')');
+ }
+ }
+
+ private void processSingleAttribute(StringBuilder buffer, Attr attr)
+ {
+ String name = attr.getName();
+ String value = attr.getValue();
+ buffer.append(name);
+ buffer.append('=');
+ buffer.append(value);
+ }
+}
Property changes on: core/trunk/src/main/java/org/jboss/cache/config/parsing/element/JGroupsStackParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/element/LoadersElementParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/element/LoadersElementParser.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/LoadersElementParser.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -25,6 +25,7 @@
import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.config.parsing.XmlParserBase;
+import org.jboss.cache.config.parsing.RootElementBuilder;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -42,6 +43,16 @@
*/
public class LoadersElementParser extends XmlParserBase
{
+ public LoadersElementParser()
+ {
+ this(RootElementBuilder.JBOSSCACHE_CORE_NS_31);
+ }
+
+ public LoadersElementParser(String coreNamespace)
+ {
+ this.coreNamespace = coreNamespace;
+ }
+
public CacheLoaderConfig parseLoadersElement(Element element)
{
assertNotLegacyElement(element);
Modified: core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/CacheJmxWrapper.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -36,8 +36,9 @@
import org.jboss.cache.config.EvictionConfig;
import org.jboss.cache.config.LegacyConfigurationException;
import org.jboss.cache.config.RuntimeConfig;
-import org.jboss.cache.config.parsing.JGroupsStackParser;
+import org.jboss.cache.config.parsing.element.JGroupsStackParser;
import org.jboss.cache.config.parsing.XmlConfigurationParser2x;
+import org.jboss.cache.config.parsing.RootElementBuilder;
import org.jboss.cache.config.parsing.element.BuddyElementParser;
import org.jboss.cache.config.parsing.element.EvictionElementParser;
import org.jboss.cache.config.parsing.element.LoadersElementParser;
Added: core/trunk/src/main/resources/schema/jbosscache-config-3.0.xsd
===================================================================
--- core/trunk/src/main/resources/schema/jbosscache-config-3.0.xsd (rev 0)
+++ core/trunk/src/main/resources/schema/jbosscache-config-3.0.xsd 2009-02-24 13:34:08 UTC (rev 7769)
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
+ xmlns:tns="urn:jboss:jbosscache-core:config:3.0" targetNamespace="urn:jboss:jbosscache-core:config:3.0"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
+
+ <xs:element name="jbosscache" type="tns:cacheConfigurationType"/>
+
+ <xs:complexType name="cacheConfigurationType">
+ <xs:all>
+ <xs:element name="locking" type="tns:lockingType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="transaction" type="tns:transactionType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="startup" type="tns:startupType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="shutdown" type="tns:shutdownType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="serialization" type="tns:serializationType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="jmxStatistics" type="tns:jmxStatisticsType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="listeners" type="tns:listenersType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="invocationBatching" type="tns:invocationBatchingType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="eviction" type="tns:evictionType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="loaders" type="tns:loadersType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="customInterceptors" type="tns:customInterceptorsType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="clustering" type="tns:clusteringType" minOccurs="0" maxOccurs="1"/>
+ </xs:all>
+ </xs:complexType>
+
+ <xs:complexType name="clusteringType">
+ <xs:all>
+ <xs:element name="sync" type="tns:syncType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="async" type="tns:asyncType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="stateRetrieval" type="tns:stateRetrievalType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="buddy" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:all minOccurs="0">
+ <xs:element name="dataGravitation" maxOccurs="1">
+ <xs:complexType>
+ <xs:attribute name="auto" type="tns:booleanType"/>
+ <xs:attribute name="removeOnFind" type="tns:booleanType"/>
+ <xs:attribute name="searchBackupTrees" type="tns:booleanType"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="locator" maxOccurs="1">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="properties" type="xs:string" maxOccurs="1"/>
+ </xs:all>
+ <xs:attribute name="class" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:all>
+ <xs:attribute name="enabled" type="tns:booleanType"/>
+ <xs:attribute name="poolName" type="xs:string"/>
+ <xs:attribute name="communicationTimeout" type="xs:integer"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="jgroupsConfig" type="tns:jgroupsConfigType" minOccurs="0" maxOccurs="1"/>
+ </xs:all>
+ <xs:attribute name="mode">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:pattern
+ value="[Rr][Ee][Pp][Ll][Ii][Cc][Aa][Tt][Ii][Oo][Nn]|[Ii][Nn][Vv][Aa][Ll][Ii][Dd][Aa][Tt][Ii][Oo][Nn]|[Rr]|[Ii]|\$\{.*\}"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="clusterName" type="xs:string" />
+
+
+ </xs:complexType>
+
+ <xs:complexType name="lockingType">
+ <xs:attribute name="isolationLevel">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:pattern
+ value="[Ss][Ee][Rr][Ii][Aa][Ll][Ii][Zz][Aa][Bb][Ll][Ee]|[Rr][Ee][Pp][Ee][Aa][Tt][Aa][Bb][Ll][Ee]_[Rr][Ee][Aa][Dd]|[Rr][Ee][Aa][Dd]_[Cc][Oo][Mm][Mm][Ii][Tt][Tt][Ee][Dd]|[Nn][Oo][Nn][Ee]|\$\{.*\}"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="lockParentForChildInsertRemove" type="tns:booleanType"/>
+ <xs:attribute name="lockAcquisitionTimeout" type="tns:positiveInteger"/>
+ <xs:attribute name="nodeLockingScheme">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:pattern
+ value="[Mm][Vv][Cc][Cc]|[Oo][Pp][Tt][Ii][Mm][Ii][Ss][Tt][Ii][Cc]|[Pp][Ee][Ss][Ss][Ii][Mm][Ii][Ss][Tt][Ii][Cc]|\$\{.*\}"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="writeSkewCheck" type="tns:booleanType"/>
+ <xs:attribute name="concurrencyLevel" type="xs:integer"/>
+ </xs:complexType>
+
+ <xs:complexType name="transactionType">
+ <xs:attribute name="transactionManagerLookupClass" type="xs:string"/>
+ <xs:attribute name="syncRollbackPhase" type="tns:booleanType"/>
+ <xs:attribute name="syncCommitPhase" type="tns:booleanType"/>
+ </xs:complexType>
+
+ <xs:complexType name="startupType">
+ <xs:attribute name="regionsInactiveOnStartup" type="tns:booleanType"/>
+ </xs:complexType>
+
+ <xs:complexType name="stateRetrievalType">
+ <xs:attribute name="fetchInMemoryState" type="tns:booleanType"/>
+ <xs:attribute name="timeout" type="tns:positiveInteger"/>
+ </xs:complexType>
+
+ <xs:complexType name="shutdownType">
+ <xs:attribute name="hookBehavior">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:pattern
+ value="[Dd][Ee][Ff][Aa][Uu][Ll][Tt]|[Rr][Ee][Gg][Ii][Ss][Tt][Ee][Rr]|[Dd][Oo][Nn][Tt]_[Rr][Ee][Gg][Ii][Ss][Tt][Ee][Rr]|\$\{.*\}"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+
+ <xs:complexType name="serializationType">
+ <xs:attribute name="objectInputStreamPoolSize" type="tns:positiveInteger"/>
+ <xs:attribute name="objectOutputStreamPoolSize" type="tns:positiveInteger"/>
+ <xs:attribute name="version" type="xs:string"/>
+ <xs:attribute name="marshallerClass" type="xs:string"/>
+ <xs:attribute name="useLazyDeserialization" type="tns:booleanType"/>
+ <xs:attribute name="useRegionBasedMarshalling" type="tns:booleanType"/>
+ </xs:complexType>
+
+ <xs:simpleType name="booleanType">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="\$\{.*\}|[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="positiveInteger">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="\$\{.*\}|\+?[0-9]*"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="jmxStatisticsType">
+ <xs:attribute name="enabled" type="tns:booleanType"/>
+ </xs:complexType>
+
+ <xs:complexType name="listenersType">
+ <xs:attribute name="asyncPoolSize" type="tns:positiveInteger"/>
+ <xs:attribute name="asyncQueueSize" type="tns:positiveInteger"/>
+ </xs:complexType>
+
+ <xs:complexType name="invocationBatchingType">
+ <xs:attribute name="enabled" type="tns:booleanType"/>
+ </xs:complexType>
+
+ <xs:complexType name="jgroupsConfigType">
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="configFile" type="xs:string"/>
+ <xs:attribute name="multiplexerStack" type="xs:string"/>
+ </xs:complexType>
+
+ <xs:complexType name="syncType">
+ <xs:attribute name="replTimeout" type="tns:positiveInteger"/>
+ </xs:complexType>
+
+ <xs:complexType name="asyncType">
+ <xs:attribute name="useReplQueue" type="tns:booleanType"/>
+ <xs:attribute name="replQueueInterval" type="tns:positiveInteger"/>
+ <xs:attribute name="replQueueMaxElements" type="tns:positiveInteger"/>
+ <xs:attribute name="serializationExecutorPoolSize" type="tns:positiveInteger"/>
+ <xs:attribute name="serializationExecutorQueueSize" type="tns:positiveInteger"/>
+ </xs:complexType>
+
+ <xs:complexType name="evictionType">
+ <xs:sequence>
+ <xs:element name="default" type="tns:evictionRegionType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="region" minOccurs="0" maxOccurs="unbounded" type="tns:evictionRegionType"/>
+ </xs:sequence>
+ <xs:attribute name="wakeUpInterval" type="tns:positiveInteger" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="evictionRegionType">
+ <xs:sequence>
+ <xs:element name="property" minOccurs="0" maxOccurs="unbounded" type="tns:propertyType"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="algorithmClass" type="xs:string"/>
+ <xs:attribute name="actionPolicyClass" type="xs:string"/>
+ <xs:attribute name="eventQueueSize" type="tns:positiveInteger"/>
+ </xs:complexType>
+
+ <xs:complexType name="loadersType">
+ <xs:sequence>
+ <xs:element name="preload" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="node" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="fqn" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="loader" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="properties"/>
+ <xs:element name="singletonStore" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="properties" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ </xs:all>
+ <xs:attribute name="enabled" type="tns:booleanType"/>
+ <xs:attribute name="class" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:all>
+ <xs:attribute name="class" type="xs:string"/>
+ <xs:attribute name="async" type="tns:booleanType"/>
+ <xs:attribute name="fetchPersistentState" type="tns:booleanType"/>
+ <xs:attribute name="ignoreModifications" type="tns:booleanType"/>
+ <xs:attribute name="purgeOnStartup" type="tns:booleanType"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="passivation" type="tns:booleanType"/>
+ <xs:attribute name="shared" type="tns:booleanType"/>
+ </xs:complexType>
+
+ <xs:complexType name="customInterceptorsType">
+ <xs:sequence>
+ <xs:element name="interceptor" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="property" maxOccurs="unbounded" type="tns:propertyType" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute name="class" type="xs:string"/>
+ <xs:attribute name="position">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[Ff][Ii][Rr][Ss][Tt]|[Ll][Aa][Ss][Tt]"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="before" type="xs:string"/>
+ <xs:attribute name="after" type="xs:string"/>
+ <xs:attribute name="index" type="tns:positiveInteger"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="propertyType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string"/>
+ <xs:attribute name="value" type="xs:string"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+</xs:schema>
+
Added: core/trunk/src/main/resources/schema/jbosscache-registry-3.0.xsd
===================================================================
--- core/trunk/src/main/resources/schema/jbosscache-registry-3.0.xsd (rev 0)
+++ core/trunk/src/main/resources/schema/jbosscache-registry-3.0.xsd 2009-02-24 13:34:08 UTC (rev 7769)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
+ xmlns:tns="urn:jboss:jbosscache-core:config:3.0"
+ xmlns:repo="urn:jboss:jbosscache-core:cache-repo:3.0"
+ targetNamespace="urn:jboss:jbosscache-core:cache-repo:3.0"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
+ <xs:import schemaLocation="jbosscache-config-3.0.xsd" namespace="urn:jboss:jbosscache-core:config:3.0"/>
+
+ <xs:element name="cache-configs">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="cache-config" type="repo:cacheConfig" minOccurs="1" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="cacheConfig">
+ <xs:complexContent>
+ <xs:extension base="tns:cacheConfigurationType" xml:space="default">
+ <xs:attribute name="name" type="xs:string"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+</xs:schema>
Modified: core/trunk/src/test/java/org/jboss/cache/config/parsing/CacheLoadersElementParserTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/CacheLoadersElementParserTest.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/CacheLoadersElementParserTest.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -109,7 +109,7 @@
}
- public void testSingletonStoreDisaled() throws Exception
+ public void testSingletonStoreDisabled() throws Exception
{
String xml =
" <loaders passivation=\"true\" shared=\"true\">\n" +
Modified: core/trunk/src/test/java/org/jboss/cache/config/parsing/JGroupsStackParserTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/JGroupsStackParserTest.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/JGroupsStackParserTest.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -2,9 +2,10 @@
import org.testng.annotations.Test;
import org.w3c.dom.Element;
+import org.jboss.cache.config.parsing.element.JGroupsStackParser;
/**
- * Tester class for {@link org.jboss.cache.config.parsing.JGroupsStackParser}
+ * Tester class for {@link org.jboss.cache.config.parsing.element.JGroupsStackParser}
*
* @author Mircea.Markus(a)jboss.com
* @since 3.0
Added: core/trunk/src/test/java/org/jboss/cache/config/parsing/ParseFileWith30SchemaTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/config/parsing/ParseFileWith30SchemaTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/config/parsing/ParseFileWith30SchemaTest.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -0,0 +1,28 @@
+package org.jboss.cache.config.parsing;
+
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.ConfigurationException;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "config.parsing.ParseFileWith30SchemaTest")
+public class ParseFileWith30SchemaTest
+{
+ public void testFileWithDeclared30Schema()
+ {
+ String fileToTest = "configs/simple-3_0-config-file.xml";
+ XmlConfigurationParser parser = new XmlConfigurationParser();
+ assert parser.isValidating();
+ Configuration c = parser.parseFile(fileToTest);
+ assert c.getLockAcquisitionTimeout() == 500;
+ }
+
+ @Test (expectedExceptions = ConfigurationException.class)
+ public void testFileWithDeclared30SchemaWith31Elements()
+ {
+ String fileToTest = "configs/incorrect-3_0-config-file.xml";
+ XmlConfigurationParser parser = new XmlConfigurationParser();
+ assert parser.isValidating();
+ Configuration c = parser.parseFile(fileToTest);
+ assert false : "Should throw exception!";
+ }
+}
Modified: core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2009-02-24 12:56:11 UTC (rev 7768)
+++ core/trunk/src/test/java/org/jboss/cache/profiling/AbstractProfileTest.java 2009-02-24 13:34:08 UTC (rev 7769)
@@ -3,7 +3,7 @@
import org.jboss.cache.Cache;
import org.jboss.cache.UnitTestCacheFactory;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.parsing.JGroupsStackParser;
+import org.jboss.cache.config.parsing.element.JGroupsStackParser;
import org.jboss.cache.config.parsing.XmlConfigHelper;
import org.jboss.cache.factories.UnitTestConfigurationFactory;
import org.jboss.cache.util.TestingUtil;
Added: core/trunk/src/test/resources/configs/incorrect-3_0-config-file.xml
===================================================================
--- core/trunk/src/test/resources/configs/incorrect-3_0-config-file.xml (rev 0)
+++ core/trunk/src/test/resources/configs/incorrect-3_0-config-file.xml 2009-02-24 13:34:08 UTC (rev 7769)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.0">
+ <locking lockAcquisitionTimeout="500"/>
+ <clustering>
+ <stateRetrieval fetchInMemoryState="true" nonBlocking="true" />
+ </clustering>
+</jbosscache>
Added: core/trunk/src/test/resources/configs/simple-3_0-config-file.xml
===================================================================
--- core/trunk/src/test/resources/configs/simple-3_0-config-file.xml (rev 0)
+++ core/trunk/src/test/resources/configs/simple-3_0-config-file.xml 2009-02-24 13:34:08 UTC (rev 7769)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:jboss:jbosscache-core:config:3.0">
+ <locking lockAcquisitionTimeout="500"/>
+</jbosscache>
14 years, 3 months
JBoss Cache SVN: r7768 - core/trunk/src/test/java/org/jboss/cache/util/log4j.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-02-24 07:56:11 -0500 (Tue, 24 Feb 2009)
New Revision: 7768
Added:
core/trunk/src/test/java/org/jboss/cache/util/log4j/MultipleFilesQuietWriter.java
Removed:
core/trunk/src/test/java/org/jboss/cache/util/log4j/MultipleFilesQuiteWriter.java
Modified:
core/trunk/src/test/java/org/jboss/cache/util/log4j/PerTestFileAppender.java
Log:
Corrected spelling
Copied: core/trunk/src/test/java/org/jboss/cache/util/log4j/MultipleFilesQuietWriter.java (from rev 7766, core/trunk/src/test/java/org/jboss/cache/util/log4j/MultipleFilesQuiteWriter.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/log4j/MultipleFilesQuietWriter.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/util/log4j/MultipleFilesQuietWriter.java 2009-02-24 12:56:11 UTC (rev 7768)
@@ -0,0 +1,153 @@
+package org.jboss.cache.util.log4j;
+
+import org.apache.log4j.helpers.QuietWriter;
+import org.apache.log4j.spi.ErrorHandler;
+
+import java.io.*;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+public class MultipleFilesQuietWriter extends QuietWriter
+{
+
+ public static final String DEFAULT_LOG_FILE = "logs/default.log";
+ private static Map<String, QuietWriter> testName2Qw = new HashMap<String, QuietWriter>();
+
+ public MultipleFilesQuietWriter(ErrorHandler errorHandler)
+ {
+ super(new Writer()
+ {
+ public void write(char cbuf[], int off, int len) throws IOException
+ {
+ throw new UnsupportedOperationException("Not implemented");//sholdn't be called
+ }
+
+ public void flush() throws IOException
+ {
+ throw new UnsupportedOperationException("Not implemented");//sholdn't be called
+ }
+
+ public void close() throws IOException
+ {
+ throw new UnsupportedOperationException("Not implemented");//sholdn't be called
+ }
+ }, errorHandler);
+ File file = new File("logs");
+ if (!file.isDirectory()) file.mkdir();
+ }
+
+ public void write(String string)
+ {
+ try
+ {
+ QuietWriter qw = getQuietWriter();
+ qw.write(string);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private QuietWriter getQuietWriter()
+ throws IOException
+ {
+ String logFile = getTestClass();
+ if (logFile == null)
+ {
+ logFile = DEFAULT_LOG_FILE;
+ } else
+ {
+ logFile = "logs/" + logFile;
+ }
+ QuietWriter qw = testName2Qw.get(logFile);
+ if (qw == null)
+ {
+ File file = new File(logFile);
+ if (file.exists())
+ {
+ file.delete();
+ file.createNewFile();
+ }
+ FileOutputStream ostream = new FileOutputStream(file);
+ Writer writer = new OutputStreamWriter(ostream);
+ qw = new QuietWriter(writer, errorHandler);
+ testName2Qw.put(logFile, qw);
+ }
+ return qw;
+ }
+
+ public void flush()
+ {
+ for (QuietWriter qw : testName2Qw.values())
+ {
+ qw.flush();
+ }
+ }
+
+ public void close() throws IOException
+ {
+ for (QuietWriter qw : testName2Qw.values())
+ {
+ qw.close();
+ }
+ }
+
+
+ public void write(int c) throws IOException
+ {
+ getQuietWriter().write(c);
+ }
+
+ public void write(char cbuf[], int off, int len) throws IOException
+ {
+ getQuietWriter().write(cbuf, off, len);
+ }
+
+ public void write(String str, int off, int len) throws IOException
+ {
+ getQuietWriter().write(str, off, len);
+ }
+
+ public void write(char cbuf[]) throws IOException
+ {
+ getQuietWriter().write(cbuf);
+ }
+
+ public Writer append(CharSequence csq) throws IOException
+ {
+ return getQuietWriter().append(csq);
+ }
+
+ public Writer append(CharSequence csq, int start, int end) throws IOException
+ {
+ return getQuietWriter().append(csq, start, end);
+ }
+
+ public Writer append(char c) throws IOException
+ {
+ return getQuietWriter().append(c);
+ }
+
+ public String getTestClass()
+ {
+ StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+ if (stack.length == 0) return null;
+ for (int i = stack.length - 1; i > 0; i--)
+ {
+ StackTraceElement e = stack[i];
+ String className = e.getClassName();
+ if (className.indexOf("org.jboss.cache") != -1) return getFileName(className); //+ "." + e.getMethodName();
+ }
+ return null;
+ }
+
+ private String getFileName(String className)
+ {
+ String noPackageStr = className.substring("org.jboss.cache.".length());
+ return noPackageStr.replace('.', '_') + ".log";
+ }
+}
Deleted: core/trunk/src/test/java/org/jboss/cache/util/log4j/MultipleFilesQuiteWriter.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/log4j/MultipleFilesQuiteWriter.java 2009-02-24 11:28:25 UTC (rev 7767)
+++ core/trunk/src/test/java/org/jboss/cache/util/log4j/MultipleFilesQuiteWriter.java 2009-02-24 12:56:11 UTC (rev 7768)
@@ -1,153 +0,0 @@
-package org.jboss.cache.util.log4j;
-
-import org.apache.log4j.helpers.QuietWriter;
-import org.apache.log4j.spi.ErrorHandler;
-
-import java.io.*;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Mircea.Markus(a)jboss.com
- */
-public class MultipleFilesQuiteWriter extends QuietWriter
-{
-
- public static final String DEFAULT_LOG_FILE = "logs/default.log";
- private static Map<String, QuietWriter> testName2Qw = new HashMap<String, QuietWriter>();
-
- public MultipleFilesQuiteWriter(ErrorHandler errorHandler)
- {
- super(new Writer()
- {
- public void write(char cbuf[], int off, int len) throws IOException
- {
- throw new UnsupportedOperationException("Not implemented");//sholdn't be called
- }
-
- public void flush() throws IOException
- {
- throw new UnsupportedOperationException("Not implemented");//sholdn't be called
- }
-
- public void close() throws IOException
- {
- throw new UnsupportedOperationException("Not implemented");//sholdn't be called
- }
- }, errorHandler);
- File file = new File("logs");
- if (!file.isDirectory()) file.mkdir();
- }
-
- public void write(String string)
- {
- try
- {
- QuietWriter qw = getQuietWriter();
- qw.write(string);
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- private QuietWriter getQuietWriter()
- throws IOException
- {
- String logFile = getTestClass();
- if (logFile == null)
- {
- logFile = DEFAULT_LOG_FILE;
- } else
- {
- logFile = "logs/" + logFile;
- }
- QuietWriter qw = testName2Qw.get(logFile);
- if (qw == null)
- {
- File file = new File(logFile);
- if (file.exists())
- {
- file.delete();
- file.createNewFile();
- }
- FileOutputStream ostream = new FileOutputStream(file);
- Writer writer = new OutputStreamWriter(ostream);
- qw = new QuietWriter(writer, errorHandler);
- testName2Qw.put(logFile, qw);
- }
- return qw;
- }
-
- public void flush()
- {
- for (QuietWriter qw : testName2Qw.values())
- {
- qw.flush();
- }
- }
-
- public void close() throws IOException
- {
- for (QuietWriter qw : testName2Qw.values())
- {
- qw.close();
- }
- }
-
-
- public void write(int c) throws IOException
- {
- getQuietWriter().write(c);
- }
-
- public void write(char cbuf[], int off, int len) throws IOException
- {
- getQuietWriter().write(cbuf, off, len);
- }
-
- public void write(String str, int off, int len) throws IOException
- {
- getQuietWriter().write(str, off, len);
- }
-
- public void write(char cbuf[]) throws IOException
- {
- getQuietWriter().write(cbuf);
- }
-
- public Writer append(CharSequence csq) throws IOException
- {
- return getQuietWriter().append(csq);
- }
-
- public Writer append(CharSequence csq, int start, int end) throws IOException
- {
- return getQuietWriter().append(csq, start, end);
- }
-
- public Writer append(char c) throws IOException
- {
- return getQuietWriter().append(c);
- }
-
- public String getTestClass()
- {
- StackTraceElement[] stack = Thread.currentThread().getStackTrace();
- if (stack.length == 0) return null;
- for (int i = stack.length - 1; i > 0; i--)
- {
- StackTraceElement e = stack[i];
- String className = e.getClassName();
- if (className.indexOf("org.jboss.cache") != -1) return getFileName(className); //+ "." + e.getMethodName();
- }
- return null;
- }
-
- private String getFileName(String className)
- {
- String noPackageStr = className.substring("org.jboss.cache.".length());
- return noPackageStr.replace('.', '_') + ".log";
- }
-}
Modified: core/trunk/src/test/java/org/jboss/cache/util/log4j/PerTestFileAppender.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/log4j/PerTestFileAppender.java 2009-02-24 11:28:25 UTC (rev 7767)
+++ core/trunk/src/test/java/org/jboss/cache/util/log4j/PerTestFileAppender.java 2009-02-24 12:56:11 UTC (rev 7768)
@@ -1,7 +1,6 @@
package org.jboss.cache.util.log4j;
import org.apache.log4j.WriterAppender;
-import org.apache.log4j.helpers.QuietWriter;
/**
* @author Mircea.Markus(a)jboss.com
@@ -16,6 +15,6 @@
public void activateOptions()
{
super.activateOptions();
- this.qw = new MultipleFilesQuiteWriter(getErrorHandler());
+ this.qw = new MultipleFilesQuietWriter(getErrorHandler());
}
}
14 years, 3 months
JBoss Cache SVN: r7767 - in core/trunk/src/main/java/org/jboss/cache: statetransfer and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-02-24 06:28:25 -0500 (Tue, 24 Feb 2009)
New Revision: 7767
Modified:
core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java
core/trunk/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferManager.java
core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
Log:
Pretty printing of state transfer duration
Modified: core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2009-02-23 14:35:58 UTC (rev 7766)
+++ core/trunk/src/main/java/org/jboss/cache/RPCManagerImpl.java 2009-02-24 11:28:25 UTC (rev 7767)
@@ -21,29 +21,12 @@
*/
package org.jboss.cache;
-import java.net.URL;
-import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
-
-import javax.transaction.TransactionManager;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.RuntimeConfig;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.jboss.cache.config.RuntimeConfig;
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
@@ -64,6 +47,7 @@
import org.jboss.cache.statetransfer.DefaultStateTransferManager;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionTable;
+import org.jboss.cache.util.CachePrinter;
import org.jboss.cache.util.concurrent.ReclosableLatch;
import org.jboss.cache.util.reflect.ReflectionUtil;
import org.jgroups.Address;
@@ -82,6 +66,20 @@
import org.jgroups.util.Rsp;
import org.jgroups.util.RspList;
+import javax.transaction.TransactionManager;
+import java.net.URL;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
/**
* Manager that handles all RPC calls between JBoss Cache instances
*
@@ -92,12 +90,14 @@
{
private Channel channel;
private final Log log = LogFactory.getLog(RPCManagerImpl.class);
+ private final boolean trace = log.isTraceEnabled();
private volatile List<Address> members;
private long replicationCount;
private long replicationFailures;
- private boolean statisticsEnabled = false;
+ private boolean statisticsEnabled = false;
private final Object coordinatorLock = new Object();
+
/**
* True if this Cache is the coordinator.
*/
@@ -112,7 +112,6 @@
* JGroups RpcDispatcher in use.
*/
private CommandAwareRpcDispatcher rpcDispatcher = null;
-
/**
* JGroups message listener.
*/
@@ -121,7 +120,6 @@
private Notifier notifier;
private CacheSPI spi;
private InvocationContextContainer invocationContextContainer;
- private final boolean trace = log.isTraceEnabled();
private Marshaller marshaller;
private TransactionManager txManager;
private TransactionTable txTable;
@@ -191,7 +189,7 @@
{
if (channel.flushSupported() && !flushBlockGate.await(timeout, TimeUnit.MILLISECONDS))
{
- throw new TimeoutException("State retrieval timed out waiting for flush to unblock. (timeout = " + timeout + " millis) ");
+ throw new TimeoutException("State retrieval timed out waiting for flush to unblock. (timeout = " + CachePrinter.prettyPrint(timeout) + ")");
}
return;
}
@@ -210,7 +208,7 @@
{
if (channel.flushSupported() && !flushWaitGate.await(timeout, TimeUnit.MILLISECONDS))
{
- throw new TimeoutException("State retrieval timed out waiting for flush to block. (timeout = " + timeout + " millis) ");
+ throw new TimeoutException("State retrieval timed out waiting for flush to block. (timeout = " + CachePrinter.prettyPrint(timeout) + " )");
}
return;
}
@@ -304,7 +302,7 @@
switch (configuration.getCacheMode())
{
case LOCAL:
- log.debug("cache mode is local, will not create the channel");
+ if (log.isDebugEnabled()) log.debug("cache mode is local, will not create the channel");
isInLocalMode = true;
isUsingBuddyReplication = false;
break;
@@ -314,10 +312,7 @@
case INVALIDATION_SYNC:
isInLocalMode = false;
isUsingBuddyReplication = configuration.getBuddyReplicationConfig() != null && configuration.getBuddyReplicationConfig().isEnabled();
- if (log.isDebugEnabled())
- {
- log.debug("Cache mode is " + configuration.getCacheMode());
- }
+ if (log.isDebugEnabled()) log.debug("Cache mode is " + configuration.getCacheMode());
boolean fetchState = shouldFetchStateOnStartup();
boolean nonBlocking = configuration.isNonBlockingStateTransfer();
@@ -334,10 +329,7 @@
componentRegistry.setBlockInStarting(false);
}
channel.connect(configuration.getClusterName());
- if (log.isInfoEnabled())
- {
- log.info("Cache local address is " + getLocalAddress());
- }
+ if (log.isInfoEnabled()) log.info("Cache local address is " + getLocalAddress());
}
catch (ChannelException e)
{
@@ -361,15 +353,9 @@
try
{
channel.connect(configuration.getClusterName(), null, null, configuration.getStateRetrievalTimeout());
- if (log.isInfoEnabled())
- {
- log.info("Cache local address is " + getLocalAddress());
- }
+ if (log.isInfoEnabled()) log.info("Cache local address is " + getLocalAddress());
- if (getMembers().size() > 1)
- {
- messageListener.waitForState();
- }
+ if (getMembers().size() > 1) messageListener.waitForState();
}
catch (ChannelException e)
{
@@ -384,12 +370,8 @@
}
}
- if (log.isInfoEnabled())
- {
- log.info("state was retrieved successfully (in " + (System.currentTimeMillis() - start) + " milliseconds)");
- }
+ if (log.isInfoEnabled()) log.info("state was retrieved successfully (in " + CachePrinter.prettyPrint((System.currentTimeMillis() - start)) + ")");
}
-
}
private void startNonBlockStateTransfer(List<Address> members)
@@ -414,10 +396,7 @@
try
{
- if (log.isInfoEnabled())
- {
- log.info("Trying to fetch state from: " + member);
- }
+ if (log.isInfoEnabled()) log.info("Trying to fetch state from: " + member);
if (getState(null, member))
{
messageListener.waitForState();
@@ -427,19 +406,13 @@
}
catch (Exception e)
{
- if (log.isDebugEnabled())
- {
- log.debug("Error while fetching state", e);
- }
+ if (log.isDebugEnabled()) log.debug("Error while fetching state", e);
}
}
if (!success)
{
- if (log.isWarnEnabled())
- {
- log.warn("Could not find available peer for state, backing off and retrying");
- }
+ if (log.isWarnEnabled()) log.warn("Could not find available peer for state, backing off and retrying");
try
{
@@ -466,7 +439,7 @@
{
if (channel != null && channel.isOpen())
{
- log.info("Disconnecting and closing the Channel");
+ if (log.isInfoEnabled()) log.info("Disconnecting and closing the Channel");
channel.disconnect();
channel.close();
}
@@ -488,7 +461,7 @@
configuration.getRuntimeConfig().setChannel(null);
if (rpcDispatcher != null)
{
- log.info("Stopping the RpcDispatcher");
+ if (log.isInfoEnabled()) log.info("Stopping the RpcDispatcher");
rpcDispatcher.stop();
}
@@ -521,10 +494,7 @@
{
ReflectionUtil.setValue(configuration, "accessible", true);
configuration.setUsingMultiplexer(true);
- if (log.isDebugEnabled())
- {
- log.debug("Created Multiplexer Channel for cache cluster " + configuration.getClusterName() + " using stack " + configuration.getMultiplexerStack());
- }
+ if (log.isDebugEnabled()) log.debug("Created Multiplexer Channel for cache cluster " + configuration.getClusterName() + " using stack " + configuration.getMultiplexerStack());
}
else
{
@@ -533,20 +503,17 @@
if (configuration.getJGroupsConfigFile() != null)
{
URL u = configuration.getJGroupsConfigFile();
- if (log.isTraceEnabled()) log.trace("Grabbing cluster properties from " + u);
+ if (trace) log.trace("Grabbing cluster properties from " + u);
channel = new JChannel(u);
}
else if (configuration.getClusterConfig() == null)
{
- log.debug("setting cluster properties to default value");
+ if (log.isDebugEnabled()) log.debug("setting cluster properties to default value");
channel = new JChannel(configuration.getDefaultClusterConfig());
}
else
{
- if (trace)
- {
- log.trace("Cache cluster properties: " + configuration.getClusterConfig());
- }
+ if (trace) log.trace("Cache cluster properties: " + configuration.getClusterConfig());
channel = new JChannel(configuration.getClusterConfig());
}
}
@@ -700,14 +667,8 @@
if (rpcDispatcher == null) return null;
int modeToUse = mode;
int preferredMode;
- if ((preferredMode = spi.getInvocationContext().getOptionOverrides().getGroupRequestMode()) > -1)
- {
- modeToUse = preferredMode;
- }
- if (trace)
- {
- log.trace("callRemoteMethods(): valid members are " + recipients + " methods: " + command + " Using OOB? " + useOutOfBandMessage + " modeToUse: " + modeToUse);
- }
+ if ((preferredMode = spi.getInvocationContext().getOptionOverrides().getGroupRequestMode()) > -1) modeToUse = preferredMode;
+ if (trace) log.trace("callRemoteMethods(): valid members are " + recipients + " methods: " + command + " Using OOB? " + useOutOfBandMessage + " modeToUse: " + modeToUse);
flushTracker.lockProcessingLock();
unlock = true;
@@ -716,10 +677,7 @@
useOutOfBandMessage = false;
RspList rsps = rpcDispatcher.invokeRemoteCommands(recipients, command, modeToUse, timeout, isUsingBuddyReplication, useOutOfBandMessage, responseFilter);
if (mode == GroupRequest.GET_NONE) return Collections.emptyList();// async case
- if (trace)
- {
- log.trace("(" + getLocalAddress() + "): responses for method " + command.getClass().getSimpleName() + ":\n" + rsps);
- }
+ if (trace) log.trace("(" + getLocalAddress() + "): responses for method " + command.getClass().getSimpleName() + ":\n" + rsps);
// short-circuit no-return-value calls.
if (rsps == null) return Collections.emptyList();
List<Object> retval = new ArrayList<Object>(rsps.size());
@@ -791,10 +749,7 @@
// should this really be throwing an exception? Are there valid use cases where partial state may not be available? - Manik
// Yes -- cache is configured LOCAL but app doesn't know it -- Brian
//throw new IllegalArgumentException("Cannot fetch partial state, targets are " + sources + " and stateId is " + stateId);
- if (log.isWarnEnabled())
- {
- log.warn("Cannot fetch partial state, targets are " + sources + " and stateId is " + stateId);
- }
+ if (log.isWarnEnabled()) log.warn("Cannot fetch partial state, targets are " + sources + " and stateId is " + stateId);
return;
}
@@ -811,19 +766,13 @@
return;
}
- if (log.isDebugEnabled())
- {
- log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from members " + targets);
- }
+ if (log.isDebugEnabled()) log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from members " + targets);
boolean successfulTransfer = false;
for (Address target : targets)
{
try
{
- if (log.isDebugEnabled())
- {
- log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from member " + target);
- }
+ if (log.isDebugEnabled()) log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from member " + target);
messageListener.setStateSet(false);
successfulTransfer = getState(stateId, target);
if (successfulTransfer)
@@ -834,31 +783,21 @@
}
catch (Exception transferFailed)
{
- if (log.isTraceEnabled()) log.trace("Error while fetching state", transferFailed);
+ if (trace) log.trace("Error while fetching state", transferFailed);
successfulTransfer = false;
}
}
- if (log.isDebugEnabled())
- {
- log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from member " + target + (successfulTransfer ? " successful" : " failed"));
- }
+ if (log.isDebugEnabled()) log.debug("Node " + getLocalAddress() + " fetching partial state " + stateId + " from member " + target + (successfulTransfer ? " successful" : " failed"));
if (successfulTransfer) break;
}
catch (IllegalStateException ise)
{
// thrown by the JGroups channel if state retrieval fails.
- if (log.isInfoEnabled())
- {
- log.info("Channel problems fetching state. Continuing on to next provider. ", ise);
- }
+ if (log.isInfoEnabled()) log.info("Channel problems fetching state. Continuing on to next provider. ", ise);
}
}
- if (!successfulTransfer && log.isDebugEnabled())
- {
- log.debug("Node " + getLocalAddress() + " could not fetch partial state " + stateId + " from any member " + targets);
- }
-
+ if (!successfulTransfer && log.isDebugEnabled()) log.debug("Node " + getLocalAddress() + " could not fetch partial state " + stateId + " from any member " + targets);
}
private boolean getState(String stateId, Address target) throws ChannelNotConnectedException, ChannelClosedException
@@ -925,7 +864,7 @@
{
while (members == null || members.isEmpty())
{
- log.debug("getCoordinator(): waiting on viewAccepted()");
+ if (log.isDebugEnabled()) log.debug("getCoordinator(): waiting on viewAccepted()");
try
{
coordinatorLock.wait();
@@ -1142,7 +1081,7 @@
{
ProtocolStack stack = ((JChannel) channel).getProtocolStack();
TP transport = stack.getTransport();
- if (transport.isEnableBundling())
+ if (transport.isEnableBundling() && log.isWarnEnabled())
{
log.warn("You have enabled jgroups's message bundling, which is not recommended for sync replication. If there is no particular " +
"reason for this we strongly recommend to disable message bundling in JGroups config (enable_bundling=\"false\").");
@@ -1153,7 +1092,7 @@
{
ProtocolStack stack = ((JChannel) channel).getProtocolStack();
TP transport = stack.getTransport();
- if (!transport.isEnableBundling())
+ if (!transport.isEnableBundling() && log.isWarnEnabled())
{
log.warn("You have disabled jgroups's message bundling, which is not recommended for async replication. If there is no particular " +
"reason for this we strongly recommend to enable message bundling in JGroups config (enable_bundling=\"true\").");
Modified: core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java 2009-02-23 14:35:58 UTC (rev 7766)
+++ core/trunk/src/main/java/org/jboss/cache/statetransfer/DefaultStateTransferManager.java 2009-02-24 11:28:25 UTC (rev 7767)
@@ -38,6 +38,7 @@
import org.jboss.cache.marshall.Marshaller;
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.marshall.NodeDataMarker;
+import org.jboss.cache.util.CachePrinter;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -104,7 +105,7 @@
generator.generateState(out, subtreeRoot, fetchTransientState, fetchPersistentState, suppressErrors);
if (log.isDebugEnabled())
- log.debug("Successfully generated state in " + (System.currentTimeMillis() - startTime) + " msec");
+ log.debug("Successfully generated state in " + CachePrinter.prettyPrint(System.currentTimeMillis() - startTime));
}
else
{
@@ -195,6 +196,6 @@
integrator.integrateState(state, targetRoot.getDelegationTarget(), targetRoot.getFqn(), fetchPersistentState);
if (log.isDebugEnabled())
- log.debug("successfully integrated state in " + (System.currentTimeMillis() - startTime) + " msec");
+ log.debug("successfully integrated state in " + CachePrinter.prettyPrint(System.currentTimeMillis() - startTime));
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferManager.java 2009-02-23 14:35:58 UTC (rev 7766)
+++ core/trunk/src/main/java/org/jboss/cache/statetransfer/LegacyStateTransferManager.java 2009-02-24 11:28:25 UTC (rev 7767)
@@ -25,6 +25,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.RegionEmptyException;
+import org.jboss.cache.util.CachePrinter;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.lock.LockManager;
@@ -82,7 +83,7 @@
generator.generateState(out, rootNode, fetchTransientState, fetchPersistentState, suppressErrors);
if (log.isDebugEnabled())
{
- log.debug("Successfully generated state in " + (System.currentTimeMillis() - startTime) + " msec");
+ log.debug("Successfully generated state in " + CachePrinter.prettyPrint(System.currentTimeMillis() - startTime));
}
}
finally
@@ -154,7 +155,7 @@
integrator.integrateState(state, targetRoot, targetRoot.getFqn(), fetchPersistentState);
if (log.isDebugEnabled())
{
- log.debug("successfully integrated state in " + (System.currentTimeMillis() - startTime) + " msec");
+ log.debug("successfully integrated state in " + CachePrinter.prettyPrint(System.currentTimeMillis() - startTime));
}
}
finally
Modified: core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java 2009-02-23 14:35:58 UTC (rev 7766)
+++ core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java 2009-02-24 11:28:25 UTC (rev 7767)
@@ -28,6 +28,8 @@
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.invocation.CacheInvocationDelegate;
+import java.text.NumberFormat;
+
/**
* Helper that prints the contents of a {@link org.jboss.cache.Cache} to a string.
*
@@ -109,4 +111,32 @@
s = s.replaceAll(" ", " ");
return s;
}
+
+ /**
+ * Prints a time for display
+ * @param millis time in millis
+ * @return the time, represented as millis, seconds, minutes or hours as appropriate, with suffix
+ */
+ public static String prettyPrint(long millis)
+ {
+ if (millis < 1000) return millis + " milliseconds";
+ NumberFormat nf = NumberFormat.getNumberInstance();
+ nf.setMaximumFractionDigits(2);
+ double toPrint = ((double) millis) / 1000;
+ if (toPrint < 300)
+ {
+ return nf.format(toPrint) + " seconds";
+ }
+
+ toPrint = toPrint / 60;
+
+ if (toPrint < 120)
+ {
+ return nf.format(toPrint) + " minutes";
+ }
+
+ toPrint = toPrint / 60;
+
+ return nf.format(toPrint) + " hours";
+ }
}
14 years, 3 months
JBoss Cache SVN: r7766 - in benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0: conf and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-02-23 09:35:58 -0500 (Mon, 23 Feb 2009)
New Revision: 7766
Added:
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-invalidate-async.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-invalidate-sync.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-local.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-repl-async.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-repl-sync.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache.xsd
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/lib/
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/lib/commons-logging.jar
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/lib/ehcache-1.6.0-beta3.jar
Log:
EHCache 1.6.0
Added: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-invalidate-async.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-invalidate-async.xml (rev 0)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-invalidate-async.xml 2009-02-23 14:35:58 UTC (rev 7766)
@@ -0,0 +1,307 @@
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
+
+ <!--
+ 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=${bind.address}, 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="true"
+ overflowToDisk="false"
+ diskPersistent="false"
+ />
+
+ <!--
+ 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="true"
+ overflowToDisk="false">
+ <cacheEventListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=true, replicatePuts=true,
+ replicateUpdates=true, replicateUpdatesViaCopy=false,
+ replicateRemovals=true"/>
+ </cache>
+
+</ehcache>
Added: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-invalidate-sync.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-invalidate-sync.xml (rev 0)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-invalidate-sync.xml 2009-02-23 14:35:58 UTC (rev 7766)
@@ -0,0 +1,306 @@
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
+
+ <!--
+ 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=${bind.address}, 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="true"
+ overflowToDisk="false"
+ diskPersistent="false"
+ />
+
+ <!--
+ 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="true"
+ overflowToDisk="false">
+ <cacheEventListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=false, replicatePuts=true,
+ replicateUpdates=true, replicateUpdatesViaCopy=false,
+ replicateRemovals=true"/>
+ </cache>
+</ehcache>
Added: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-local.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-local.xml (rev 0)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-local.xml 2009-02-23 14:35:58 UTC (rev 7766)
@@ -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>
Added: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-repl-async.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-repl-async.xml (rev 0)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-repl-async.xml 2009-02-23 14:35:58 UTC (rev 7766)
@@ -0,0 +1,307 @@
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
+
+ <!--
+ 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=${bind.address}, 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="true"
+ overflowToDisk="false"
+ diskPersistent="false"
+ />
+
+ <!--
+ 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="true"
+ overflowToDisk="false">
+ <cacheEventListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=true, replicatePuts=true,
+ replicateUpdates=true, replicateUpdatesViaCopy=true,
+ replicateRemovals=true"/>
+ </cache>
+
+</ehcache>
Added: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-repl-sync.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-repl-sync.xml (rev 0)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache-repl-sync.xml 2009-02-23 14:35:58 UTC (rev 7766)
@@ -0,0 +1,306 @@
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd">
+
+ <!--
+ 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=${bind.address}, 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="true"
+ overflowToDisk="false"
+ diskPersistent="false"
+ />
+
+ <!--
+ 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="true"
+ overflowToDisk="false">
+ <cacheEventListenerFactory
+ class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
+ properties="replicateAsynchronously=false, replicatePuts=true,
+ replicateUpdates=true, replicateUpdatesViaCopy=true,
+ replicateRemovals=true"/>
+ </cache>
+</ehcache>
Added: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache.xsd
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache.xsd (rev 0)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/conf/ehcache.xsd 2009-02-23 14:35:58 UTC (rev 7766)
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="1.6">
+ <xs:element name="ehcache" >
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" ref="diskStore"/>
+ <xs:element minOccurs="0" maxOccurs="1"
+ ref="cacheManagerEventListenerFactory"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded"
+ ref="cacheManagerPeerProviderFactory"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded"
+ ref="cacheManagerPeerListenerFactory"/>
+ <xs:element ref="defaultCache"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="cache"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="diskStore">
+ <xs:complexType>
+ <xs:attribute name="path" use="optional" />
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="cacheManagerEventListenerFactory">
+ <xs:complexType>
+ <xs:attribute name="class" use="required"/>
+ <xs:attribute name="properties" use="optional"/>
+ <xs:attribute name="propertySeparator" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="cacheManagerPeerProviderFactory">
+ <xs:complexType>
+ <xs:attribute name="class" use="required"/>
+ <xs:attribute name="properties" use="optional"/>
+ <xs:attribute name="propertySeparator" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="cacheManagerPeerListenerFactory">
+ <xs:complexType>
+ <xs:attribute name="class" use="required"/>
+ <xs:attribute name="properties" use="optional"/>
+ <xs:attribute name="propertySeparator" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <!-- add clone support for addition of cacheExceptionHandler. Important! -->
+ <xs:element name="defaultCache">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheEventListenerFactory"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheExtensionFactory"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheLoaderFactory"/>
+ <xs:element minOccurs="0" maxOccurs="1" ref="bootstrapCacheLoaderFactory"/>
+ <xs:element minOccurs="0" maxOccurs="1" ref="cacheExceptionHandlerFactory"/>
+ </xs:sequence>
+ <xs:attribute name="diskExpiryThreadIntervalSeconds" use="optional" type="xs:integer"/>
+ <xs:attribute name="diskSpoolBufferSizeMB" use="optional" type="xs:integer"/>
+ <xs:attribute name="diskPersistent" use="optional" type="xs:boolean"/>
+ <xs:attribute name="eternal" use="required" type="xs:boolean"/>
+ <xs:attribute name="maxElementsInMemory" use="required" type="xs:integer"/>
+ <xs:attribute name="memoryStoreEvictionPolicy" use="optional" type="xs:string"/>
+ <xs:attribute name="overflowToDisk" use="required" type="xs:boolean"/>
+ <xs:attribute name="timeToIdleSeconds" use="optional" type="xs:integer"/>
+ <xs:attribute name="timeToLiveSeconds" use="optional" type="xs:integer"/>
+ <xs:attribute name="maxElementsOnDisk" use="optional" type="xs:integer"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="cache">
+ <xs:complexType>
+ <xs:sequence >
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheEventListenerFactory"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheExtensionFactory"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheLoaderFactory"/>
+ <xs:element minOccurs="0" maxOccurs="1" ref="bootstrapCacheLoaderFactory"/>
+ <xs:element minOccurs="0" maxOccurs="1" ref="cacheExceptionHandlerFactory"/>
+ </xs:sequence>
+ <xs:attribute name="diskExpiryThreadIntervalSeconds" use="optional" type="xs:integer"/>
+ <xs:attribute name="diskSpoolBufferSizeMB" use="optional" type="xs:integer"/>
+ <xs:attribute name="diskPersistent" use="optional" type="xs:boolean"/>
+ <xs:attribute name="eternal" use="required" type="xs:boolean"/>
+ <xs:attribute name="maxElementsInMemory" use="required" type="xs:integer"/>
+ <xs:attribute name="memoryStoreEvictionPolicy" use="optional" type="xs:string"/>
+ <xs:attribute name="name" use="required" type="xs:string"/>
+ <xs:attribute name="overflowToDisk" use="required" type="xs:boolean"/>
+ <xs:attribute name="timeToIdleSeconds" use="optional" type="xs:integer"/>
+ <xs:attribute name="timeToLiveSeconds" use="optional" type="xs:integer"/>
+ <xs:attribute name="maxElementsOnDisk" use="optional" type="xs:integer"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="cacheEventListenerFactory">
+ <xs:complexType>
+ <xs:attribute name="class" use="required"/>
+ <xs:attribute name="properties" use="optional"/>
+ <xs:attribute name="propertySeparator" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="bootstrapCacheLoaderFactory">
+ <xs:complexType>
+ <xs:attribute name="class" use="required"/>
+ <xs:attribute name="properties" use="optional"/>
+ <xs:attribute name="propertySeparator" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="cacheExtensionFactory">
+ <xs:complexType>
+ <xs:attribute name="class" use="required"/>
+ <xs:attribute name="properties" use="optional"/>
+ <xs:attribute name="propertySeparator" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="cacheExceptionHandlerFactory">
+ <xs:complexType>
+ <xs:attribute name="class" use="required"/>
+ <xs:attribute name="properties" use="optional"/>
+ <xs:attribute name="propertySeparator" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="cacheLoaderFactory">
+ <xs:complexType>
+ <xs:attribute name="class" use="required"/>
+ <xs:attribute name="properties" use="optional"/>
+ <xs:attribute name="propertySeparator" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
Added: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/lib/commons-logging.jar
===================================================================
(Binary files differ)
Property changes on: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/lib/commons-logging.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/lib/ehcache-1.6.0-beta3.jar
===================================================================
(Binary files differ)
Property changes on: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/lib/ehcache-1.6.0-beta3.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 3 months
JBoss Cache SVN: r7765 - in benchmarks/benchmark-fwk/trunk: cache-products/ehcache-1.6.0 and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-02-23 09:28:32 -0500 (Mon, 23 Feb 2009)
New Revision: 7765
Removed:
benchmarks/benchmark-fwk/trunk/runAllLocalRC.sh
Modified:
benchmarks/benchmark-fwk/trunk/build.xml
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/config.sh
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheReplicationTest.java
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheTest.java
benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheWrapper.java
benchmarks/benchmark-fwk/trunk/runAllLocal.sh
benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java
Log:
EHCache 1.6.0
Modified: benchmarks/benchmark-fwk/trunk/build.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/build.xml 2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/build.xml 2009-02-23 14:28:32 UTC (rev 7765)
@@ -60,7 +60,7 @@
-Dorg.cachebench.plugins.jbosscache1=true -Dbind.address=${MYTESTIP_1}
-Dorg.cachebench.plugins.jbosscache2=true -Dbind.address=${MYTESTIP_1}
- -Dorg.cachebench.pluins.ehcache=true -Dbind.address=${MYTESTIP_1}
+ -Dorg.cachebench.plugins.ehcache=true -Dbind.address=${MYTESTIP_1}
-Dorg.cachebench.plugins.coherence=true -Dtangosol.coherence.localhost=${MYTESTIP_1}
// WORK IN PROGRESS
-Dorg.cachebench.plugins.terracotta=true
@@ -102,6 +102,22 @@
</javac>
</target>
+ <target name="compile.module.ehcache160" depends="fwk"
+ description="Compile module ehcache-1.6.0; production classes">
+ <mkdir dir="./classes/production/ehcache-1.6.0"/>
+ <javac destdir="./classes/production/ehcache-1.6.0" debug="${compiler.debug}"
+ nowarn="${compiler.generate.no.warnings}" fork="true">
+ <classpath>
+ <fileset dir="./cache-products/ehcache-1.6.0/lib" includes="*.jar"/>
+ <fileset dir="./lib/common" includes="*.jar"/>
+ <pathelement location="./cache-products/ehcache-1.6.0/conf"/>
+ <pathelement location="${framework.output.dir}"/>
+ <pathelement location="./classes/production/ehcache-1.6.0"/>
+ </classpath>
+ <src path="./cache-products/ehcache-1.6.0/src"/>
+ </javac>
+ </target>
+
<target name="compile.module.coherence331" depends="fwk"
description="Compile module coherence331; production classes" if="coherence.jars.present">
<mkdir dir="./classes/production/coherence-3.3.1"/>
@@ -252,7 +268,7 @@
</target>
<target name="all"
- depends="clean, fwk, compile.module.jbosscache140, compile.module.jbosscache200, compile.module.pojocache220, compile.module.jbosscache210, compile.module.jbosscache220, compile.module.terracotta250, compile.module.ehcache150, compile.module.whirlycache101, compile.module.jbosscache300, compile.module.coherence331, compile.module.starobrno"
+ depends="clean, fwk, compile.module.jbosscache140, compile.module.jbosscache200, compile.module.pojocache220, compile.module.jbosscache210, compile.module.jbosscache220, compile.module.terracotta250, compile.module.ehcache150, compile.module.ehcache160, compile.module.whirlycache101, compile.module.jbosscache300, compile.module.coherence331, compile.module.starobrno"
description="build all"/>
<target name="checkClusterAddresses" depends="fwk"
Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/config.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/config.sh 2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/config.sh 2009-02-23 14:28:32 UTC (rev 7765)
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+#see "$CACHE_ROOT/cache-products/cache.sh" for details
+
+THIS_DIR="./cache-products/ehcache-1.6.0"
+
+#setting up classpath
+for JAR in $THIS_DIR/lib/*
+do
+ CLASSPATH=$CLASSPATH:$JAR
+done
+
+CLASSPATH="$CLASSPATH:./classes/production/ehcache-1.6.0"
+CLASSPATH="$CLASSPATH:$THIS_DIR/conf"
+#--classpath was set
+
+#additional JVM options
+JVM_OPTIONS="$JVM_OPTIONS -Djava.net.preferIPv4Stack=true" JVM_OPTIONS="$JVM_OPTIONS -DcacheBenchFwk.cacheWrapperClassName=org.cachebench.cachewrappers.EHCacheWrapper"
Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheReplicationTest.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheReplicationTest.java 2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheReplicationTest.java 2009-02-23 14:28:32 UTC (rev 7765)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.cachebench.cachewrappers;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeMethod;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
+import net.sf.ehcache.Ehcache;
+
+/**
+ * @author Mircea.Markus(a)jboss.com
+ */
+@Test
+public class EHCacheReplicationTest
+{
+
+ @BeforeMethod
+ public void setUp()
+ {
+ System.setProperty("bind.address","127.0.0.1");//bind address referenced from config file
+ }
+
+
+ public void testSyncReplication() throws Exception
+ {
+ Ehcache cache1;
+ Ehcache cache2;
+
+ CacheManager c1 = new CacheManager("C:\\jboss\\benchmarks\\CacheBenchmarkFwk\\cache-products\\ehcache-1.5.0\\conf\\ehcache-repl-sync.xml");
+ CacheManager c2 = new CacheManager("C:\\jboss\\benchmarks\\CacheBenchmarkFwk\\cache-products\\ehcache-1.5.0\\conf\\ehcache-repl-sync.xml");
+
+
+ cache1 = c1.getCache("cache");
+ cache2 = c2.getCache("cache");
+
+ Thread.sleep(5000);
+
+ System.out.println("c1 members: " + c1.getCachePeerListener("RMI").getBoundCachePeers());
+ System.out.println("c2 members" + c2.getCachePeerListener("RMI").getBoundCachePeers());
+ assert c1.getCachePeerListener("RMI").getBoundCachePeers().size() == 1;
+ assert c2.getCachePeerListener("RMI").getBoundCachePeers().size() == 1;
+
+ for (int i = 0; i < 100; i++)
+ {
+ cache1.put(new Element("key" + i, "value" + i));
+ assert cache2.get("key" + i).getValue().equals("value" + i);
+ }
+ System.out.println(cache1.getKeys());
+ System.out.println(cache2.getKeys());
+
+ c1.shutdown();
+ c2.shutdown();
+ }
+
+
+ public void testInvalidation() throws Exception
+ {
+ Ehcache cache1;
+ Ehcache cache2;
+
+ CacheManager c1 = new CacheManager("C:\\jboss\\benchmarks\\CacheBenchmarkFwk\\cache-products\\ehcache-1.5.0\\conf\\ehcache-invalidate-sync.xml");
+ CacheManager c2 = new CacheManager("C:\\jboss\\benchmarks\\CacheBenchmarkFwk\\cache-products\\ehcache-1.5.0\\conf\\ehcache-invalidate-sync.xml");
+
+ cache1 = c1.getCache("cache");
+ cache2 = c2.getCache("cache");
+
+ Thread.sleep(5000);
+
+ System.out.println("c1 members: " + c1.getCachePeerListener("RMI").getBoundCachePeers());
+ System.out.println("c2 members" + c2.getCachePeerListener("RMI").getBoundCachePeers());
+ assert c1.getCachePeerListener("RMI").getBoundCachePeers().size() == 1;
+ assert c2.getCachePeerListener("RMI").getBoundCachePeers().size() == 1;
+
+ cache1.put(new Element("key","value"));
+ assert cache2.get("key").getValue().equals("value");
+ cache2.put(new Element("key","newValue"));
+ assert cache1.get("key") == null;
+
+ c1.shutdown();
+ c2.shutdown();
+ }
+}
Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheTest.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheTest.java 2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheTest.java 2009-02-23 14:28:32 UTC (rev 7765)
@@ -0,0 +1,53 @@
+package org.cachebench.cachewrappers;
+
+import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
+
+import java.net.URL;
+import java.io.File;
+import java.util.Properties;
+
+import org.cachebench.CacheWrapper;
+
+/**
+ * // TODO: Add Javadocs
+ *
+ * @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
+ * @since 2.0.0
+ */
+public class EHCacheTest
+{
+
+ public static void main(String[] args) throws Exception
+ {
+
+
+ CacheWrapper w = new EHCacheWrapper();
+ Properties p = new Properties();
+ p.setProperty("config", "ehcache-repl-sync.xml");
+ w.init(p);
+
+ Ehcache cache;
+ URL url = new URL("file:///Users/manik/Code/CacheBenchFwk/cache-products/ehcache-1.2.4/conf/ehcache-repl-sync.xml");
+
+ System.out.println("URL " + url);
+
+ System.out.println("FIle: " + url.getFile());
+ CacheManager m = CacheManager.create(url);
+
+ System.out.println("Caches:");
+ for (String s : m.getCacheNames()) System.out.println(" " + s);
+
+ cache = m.getCache("cache");
+
+ for (int i=0; i<100; i++) cache.put(new Element("key" + i, "value" + i));
+
+ System.out.println(cache.getKeys());
+
+ System.out.println("members: " + m.getCachePeerListener("RMI").getBoundCachePeers());
+
+ m.shutdown();
+
+ }
+}
Modified: benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheWrapper.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheWrapper.java 2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/cache-products/ehcache-1.6.0/src/org/cachebench/cachewrappers/EHCacheWrapper.java 2009-02-23 14:28:32 UTC (rev 7765)
@@ -0,0 +1,149 @@
+package org.cachebench.cachewrappers;
+
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.Element;
+import net.sf.ehcache.config.Configuration;
+import net.sf.ehcache.config.ConfigurationFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.cachebench.CacheWrapper;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * An implementation of SerializableCacheWrapper that uses EHCache as an underlying implementation.
+ * <p/>
+ * Pass in a -Dbind.address=IP_ADDRESS
+ * ehcache propery files allows referencing system properties through syntax ${bind.address}.
+ *
+ * @author Manik Surtani (manik(a)surtani.org)
+ * @version $Id: EHCacheWrapper.java,v 1.6 2007/05/21 16:17:56 msurtani Exp $
+ */
+public class EHCacheWrapper implements CacheWrapper
+{
+ private CacheManager manager;
+ private Ehcache cache;
+ private Log log = LogFactory.getLog("org.cachebench.cachewrappers.EHCacheWrapper");
+ boolean localmode;
+
+ /* (non-Javadoc)
+ * @see org.cachebench.CacheWrapper#init(java.util.Properties)
+ */
+ public void init(Map parameters) throws Exception
+ {
+ if (log.isTraceEnabled()) log.trace("Entering EHCacheWrapper.init()");
+ localmode = (Boolean.parseBoolean((String) parameters.get("localOnly")));
+ log.debug("Initializing the cache with props " + parameters);
+ URL url = getClass().getClassLoader().getResource((String) parameters.get("config"));
+ log.debug("Config URL = " + url);
+ Configuration c = ConfigurationFactory.parseConfiguration(url);
+ c.setSource("URL of " + url);
+
+ manager = new CacheManager(c);
+ setUp();
+ log.debug("Finish Initializing the cache");
+ }
+
+ /* (non-Javadoc)
+ * @see org.cachebench.CacheWrapper#setUp()
+ */
+ public void setUp() throws Exception
+ {
+ log.info("Caches avbl:");
+ for (String s : manager.getCacheNames()) log.info(" * " + s);
+ cache = manager.getCache("cache");
+ log.info("Using named cache " + cache);
+ if (!localmode)
+ {
+ log.info("Bounded peers: " + manager.getCachePeerListener("RMI").getBoundCachePeers());
+ log.info("Remote peers: " + manager.getCacheManagerPeerProvider("RMI").listRemoteCachePeers(cache));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.cachebench.CacheWrapper#tearDown()
+ */
+ public void tearDown() throws Exception
+ {
+ manager.shutdown();
+ }
+
+ /* (non-Javadoc)
+ * @see org.cachebench.SerializableCacheWrapper#putSerializable(java.io.Serializable, java.io.Serializable)
+ */
+ public void putSerializable(Serializable key, Serializable value) throws Exception
+ {
+ Element element = new Element(key, value);
+ cache.put(element);
+ }
+
+ /* (non-Javadoc)
+ * @see org.cachebench.SerializableCacheWrapper#getSerializable(java.io.Serializable)
+ */
+ public Object getSerializable(Serializable key) throws Exception
+ {
+ return cache.get(key);
+ }
+
+ public void empty() throws Exception
+ {
+ cache.removeAll();
+ }
+
+ /* (non-Javadoc)
+ * @see org.cachebench.CacheWrapper#put(java.lang.Object, java.lang.Object)
+ */
+ public void put(List<String> path, Object key, Object value) throws Exception
+ {
+ putSerializable((Serializable) key, (Serializable) value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.cachebench.CacheWrapper#get(java.lang.Object)
+ */
+ public Object get(List<String> path, Object key) throws Exception
+ {
+ Object s = getSerializable((Serializable) key);
+ if (s instanceof Element)
+ {
+ return ((Element) s).getValue();
+ }
+ else return s;
+ }
+
+ public int getNumMembers()
+ {
+
+ return localmode ? 0 : manager.getCacheManagerPeerProvider("RMI").listRemoteCachePeers(cache).size();
+ }
+
+ public String getInfo()
+ {
+ return cache.getKeys().toString() + (localmode ? "" : (" remote peers: " + manager.getCachePeerListener("RMI").getBoundCachePeers()));
+ }
+
+ public Object getReplicatedData(List<String> path, String key) throws Exception
+ {
+ Object o = get(path, key);
+ if (log.isTraceEnabled())
+ {
+ log.trace("Result for the key: '" + key + "' is value '" + o + "'");
+ }
+ return o;
+ }
+
+ public Object startTransaction()
+ {
+ throw new UnsupportedOperationException("Does not support JTA!");
+ }
+
+ public void endTransaction(boolean successful)
+ {
+ throw new UnsupportedOperationException("Does not support JTA!");
+ }
+}
Modified: benchmarks/benchmark-fwk/trunk/runAllLocal.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/runAllLocal.sh 2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/runAllLocal.sh 2009-02-23 14:28:32 UTC (rev 7765)
@@ -7,7 +7,12 @@
export PLAIN_JVM_OPTIONS="${JVM_OPTIONS} -DcacheBenchFwk.fwkCfgFile=cachebench-local.xml -Xms2g -Xmx2g"
unset JVM_OPTIONS && export JVM_OPTIONS="${PLAIN_JVM_OPTIONS} -DcacheBenchFwk.productSuffix=(3.0.3.GA)"
./runLocalNode.sh jbosscache-3.0.0 mvcc-local-RC.xml
+unset JVM_OPTIONS && export JVM_OPTIONS="${PLAIN_JVM_OPTIONS}"
./runLocalNode.sh ehcache-1.5.0 ehcache-local.xml
+unset JVM_OPTIONS && export JVM_OPTIONS="${PLAIN_JVM_OPTIONS} -DcacheBenchFwk.productSuffix=(1.6.0.Beta3)"
+./runLocalNode.sh ehcache-1.6.0 ehcache-local.xml
+unset JVM_OPTIONS && export JVM_OPTIONS="${PLAIN_JVM_OPTIONS}"
+./runLocalNode.sh whirlycache-1.0.1
mkdir output
mv data* ./output
Deleted: benchmarks/benchmark-fwk/trunk/runAllLocalRC.sh
===================================================================
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java 2009-02-23 14:05:27 UTC (rev 7764)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java 2009-02-23 14:28:32 UTC (rev 7765)
@@ -63,7 +63,7 @@
private JFreeChart createChart(String title, DefaultCategoryDataset data, int numOperations)
{
- JFreeChart chart = ChartFactory.createBarChart3D(title, "Cache operations performed (approx): " + NumberFormat.getIntegerInstance().format(numOperations), "Average time (" + MU + "-seconds)", data, PlotOrientation.VERTICAL, true, false, false);
+ JFreeChart chart = ChartFactory.createBarChart3D(title, "Cache operations performed (approx): " + NumberFormat.getIntegerInstance().format(numOperations), "Average time (" + MU + "-seconds)", data, PlotOrientation.VERTICAL, true, true, false);
BarRenderer3D renderer = (BarRenderer3D) chart.getCategoryPlot().getRenderer();
renderer.setBaseItemLabelsVisible(true);
14 years, 3 months