JBoss Cache SVN: r8167 - in core/trunk/src/main/java/org/jboss/cache: lock and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-08-07 06:59:23 -0400 (Fri, 07 Aug 2009)
New Revision: 8167
Modified:
core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
Log:
Remove node creation race
Modified: core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2009-08-07 10:28:08 UTC (rev 8166)
+++ core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2009-08-07 10:59:23 UTC (rev 8167)
@@ -26,6 +26,7 @@
import org.jboss.cache.commands.legacy.write.CreateNodeCommand;
import org.jboss.cache.lock.IdentityLock;
import org.jboss.cache.lock.LockStrategyFactory;
+import org.jboss.cache.lock.PessimisticNodeBasedLockManager;
import org.jboss.cache.marshall.MarshalledValue;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.util.FastCopyHashMap;
@@ -161,7 +162,7 @@
throw new CacheException("Attempting to add a child [" + child.getFqn() + "] to [" + getFqn() + "]. Can only add direct children.");
}
- private NodeSPI<K, V> getOrCreateChild(Object childName, GlobalTransaction gtx, boolean createIfNotExists, boolean notify)
+ private NodeSPI<K, V> getOrCreateChild(Object childName, GlobalTransaction gtx, boolean createIfNotExists, boolean notify, PessimisticNodeBasedLockManager.LockAcquirer la)
{
NodeSPI<K, V> child;
if (childName == null)
@@ -190,6 +191,7 @@
{
if (notify) cache.getNotifier().notifyNodeCreated(childFqn, true, ctx);
child = newChild;
+ if (la != null) la.acquire(child);
children().put(childName, child);
}
}
@@ -216,7 +218,7 @@
if (f.size() == 1)
{
GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
- return getOrCreateChild(f.getLastElement(), gtx, true, notify);
+ return getOrCreateChild(f.getLastElement(), gtx, true, notify, null);
}
else
{
@@ -228,9 +230,15 @@
public NodeSPI<K, V> addChildDirect(Object o, boolean notify)
{
GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
- return getOrCreateChild(o, gtx, true, notify);
+ return getOrCreateChild(o, gtx, true, notify, null);
}
+ public NodeSPI<K, V> addChildAndAcquireLock(Object o, PessimisticNodeBasedLockManager.LockAcquirer la)
+ {
+ GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
+ return getOrCreateChild(o, gtx, true, false, la);
+ }
+
@Override
public NodeSPI<K, V> getChildDirect(Fqn fqn)
{
@@ -331,7 +339,7 @@
@Override
public NodeSPI<K, V> getOrCreateChild(Object childName, GlobalTransaction gtx)
{
- return getOrCreateChild(childName, gtx, true, true);
+ return getOrCreateChild(childName, gtx, true, true, null);
}
@Override
Modified: core/trunk/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java 2009-08-07 10:28:08 UTC (rev 8166)
+++ core/trunk/src/main/java/org/jboss/cache/lock/PessimisticNodeBasedLockManager.java 2009-08-07 10:59:23 UTC (rev 8167)
@@ -26,6 +26,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
+import org.jboss.cache.PessimisticUnversionedNode;
import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.factories.annotations.Inject;
import static org.jboss.cache.lock.LockType.WRITE;
@@ -137,12 +138,15 @@
do
{
+ boolean skipLockAcquire = false;
if (currentNode == null)
{
if (createIfNotExists)
{
// if the new node is to be marked as deleted, do not notify!
- currentNode = parent.addChildDirect(childName, !skipNotification);
+ PessimisticUnversionedNode parentInternalNode = (PessimisticUnversionedNode) parent.getDelegationTarget();
+ currentNode = parentInternalNode.addChildAndAcquireLock(childName, new LockAcquirer(ctx, WRITE, timeout, owner));
+ skipLockAcquire = true;
if (!created)
{
created = true;
@@ -171,8 +175,12 @@
Fqn currentNodeFqn = currentNode.getFqn();
- // actually acquire the lock we need. This method blocks.
- acquireNodeLock(ctx, currentNode, owner, lockTypeRequired, timeout);
+ if (!skipLockAcquire)
+ {
+ // actually acquire the lock we need. This method blocks.
+ acquireNodeLock(ctx, currentNode, owner, lockTypeRequired, timeout);
+ }
+
LockUtil.manageReverseRemove(ctx, currentNode, reverseRemoveCheck, createdNodes, commandsFactory);
// make sure the lock we acquired isn't on a deleted node/is an orphan!!
@@ -274,4 +282,31 @@
// Record the lock for release on method return or tx commit/rollback
if (acquired) ctx.addLock(lock);
}
+
+ public class LockAcquirer
+ {
+ InvocationContext ctx;
+ LockType type;
+ long timeout;
+ Object owner;
+
+ public LockAcquirer(InvocationContext ctx, LockType type, long timeout, Object owner) {
+ this.ctx = ctx;
+ this.type = type;
+ this.timeout = timeout;
+ this.owner = owner;
+ }
+
+ public void acquire(NodeSPI node)
+ {
+ try
+ {
+ acquireNodeLock(ctx, node, owner, type, timeout);
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
}
15 years, 4 months
JBoss Cache SVN: r8166 - in core/trunk: src/main/docbook/userguide/en/modules and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: galder.zamarreno(a)jboss.com
Date: 2009-08-07 06:28:08 -0400 (Fri, 07 Aug 2009)
New Revision: 8166
Modified:
core/trunk/README-Maven.txt
core/trunk/src/main/docbook/userguide/en/modules/deployment.xml
Log:
[JBCACHE-1521] (Docu: Remove AS integration sections and point to AS Clustering Guide) AS integration sections now point to Clustering guide sections and added a note about an issue with OpenJDK 6 and documentation generation.
Modified: core/trunk/README-Maven.txt
===================================================================
--- core/trunk/README-Maven.txt 2009-08-07 10:03:27 UTC (rev 8165)
+++ core/trunk/README-Maven.txt 2009-08-07 10:28:08 UTC (rev 8166)
@@ -27,6 +27,17 @@
* mvn package -P Docs: Packages the module as a JAR file, and builds the javadocs and user documentation from docbook sources.
+Important! Please note that if you try to generate user documentation using OpenJDK (at least build 14.0-b15) you might see an
+exception like this:
+ java.lang.NullPointerException
+ at org.apache.fop.render.pdf.FopPDFImage.setup(FopPDFImage.java:144)
+ at org.apache.fop.pdf.PDFDocument.addImage(PDFDocument.java:794)
+ at org.apache.fop.render.pdf.PDFRenderer.putImage(PDFRenderer.java:1725)
+ at org.apache.fop.render.pdf.PDFRenderer.renderImage(PDFRenderer.java:1652)
+ ...
+This appears to be a known issue: https://lists.launchpad.net/openjdk/msg00820.html. To get around the issue, simply switch
+to Sun JDK 5 or 6 to generate documentation.
+
* mvn install: will install the artifacts in your local repo for use by other projects (such as JBoss Cache POJO edition
which depends on JBoss Cache Core). Will also use Maven's assembly plugin to build ZIP files for download
(in target/distribution)
Modified: core/trunk/src/main/docbook/userguide/en/modules/deployment.xml
===================================================================
--- core/trunk/src/main/docbook/userguide/en/modules/deployment.xml 2009-08-07 10:03:27 UTC (rev 8165)
+++ core/trunk/src/main/docbook/userguide/en/modules/deployment.xml 2009-08-07 10:28:08 UTC (rev 8166)
@@ -37,130 +37,26 @@
</section>
<section id="deployment.microcontainer">
<title>Via JBoss Microcontainer (JBoss AS 5.x)</title>
-
- <para>
- Beginning with AS 5, JBoss AS supports deployment of POJO services via
- deployment of a file whose name ends with
- <literal>-jboss-beans.xml</literal>.
- A POJO service is one whose implementation is via a "Plain Old Java Object",
- meaning a simple java bean that isn't required to implement any special
- interfaces or extend any particular superclass. A
- <literal>Cache</literal> is a POJO service, and all the components in a
- <literal>Configuration</literal>
- are also POJOs, so deploying a cache in this way is a natural step.
- </para>
- <para>
- Deployment of the cache is done using the JBoss Microcontainer that forms the
- core of JBoss AS. JBoss Microcontainer is a sophisticated IOC framework
- similar to Spring. A <literal>-jboss-beans.xml</literal> file is basically
- a descriptor that tells the IOC framework how to assemble the various
- beans that make up a POJO service.
- </para>
- <para>
- For each configurable option exposed by the <literal>Configuration</literal>
- components, a getter/setter must be defined in the configuration class.
- This is required so that JBoss Microcontainer can, in typical IOC way,
- call these methods when the corresponding properties have been
- configured.
- </para>
- <para>
- You need to ensure that the <literal>jbosscache-core.jar</literal> and <literal>jgroups.jar</literal> libraries
- are in your server's <literal>lib</literal> directory. This is usually the case when you use JBoss AS in its
- <literal>all</literal> configuration. Note that you will have to bring in any optional jars you require, such
- as <literal>jdbm.jar</literal> based on your cache configuration.
- </para>
- <para>
- The following is an example
- <literal>-jboss-beans.xml</literal>
- file. If you
- look in the
- <literal>server/all/deploy</literal>
- directory of a JBoss AS 5
- installation, you can find several more examples.
- </para>
-
- <programlisting role="XML"><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <!-- First we create a Configuration object for the cache -->
- <bean name="ExampleCacheConfig"
- class="org.jboss.cache.config.Configuration">
- <!-- Externally injected services -->
- <property name="runtimeConfig">
- <bean class="org.jboss.cache.config.RuntimeConfig">
- <property name="transactionManager">
- <inject bean="jboss:service=TransactionManager"
- property="TransactionManager"/>
- </property>
- <property name="muxChannelFactory"><inject bean="JChannelFactory"/></property>
- </bean>
- </property>
-
- <property name="multiplexerStack">udp</property>
-
- <property name="clusterName">Example-EntityCache</property>
-
- <property name="isolationLevel">REPEATABLE_READ</property>
-
- <property name="cacheMode">REPL_SYNC</property>
-
- <property name="stateRetrievalTimeout">15000</property>
-
- <property name="syncReplTimeout">20000</property>
-
- <property name="lockAcquisitionTimeout">15000</property>
-
- <property name="exposeManagementStatistics">true</property>
- </bean>
-
- <!-- Factory to build the Cache. -->
- <bean name="DefaultCacheFactory" class="org.jboss.cache.DefaultCacheFactory">
- <constructor factoryClass="org.jboss.cache.DefaultCacheFactory"
- factoryMethod="getInstance" />
- </bean>
-
- <!-- The cache itself -->
- <bean name="ExampleCache" class="org.jboss.cache.Cache">
-
- <constructor factoryMethod="createCache">
- <factory bean="DefaultCacheFactory"/>
- <parameter class="org.jboss.cache.config.Configuration"><inject bean="ExampleCacheConfig"/></parameter>
- <parameter class="boolean">false</parameter>
- </constructor>
-
- </bean>
-
-</deployment>
-]]></programlisting>
-
<para>
- See <ulink url="http://www.jboss.org/jbossmc/docs">the JBoss Microcontainer documentation</ulink>
- for details on the above syntax. Basically, each
- <literal>bean</literal>
- element represents an object and is used to create a
- <literal>Configuration</literal>
- and its <link linkend="configuration.elements">constituent parts</link>
- The <literal>DefaultCacheFactory</literal> bean constructs the cache,
- conceptually doing the same thing as is shown in the
- <link linkend="api.create_start">User API</link> chapter.
- </para>
- <para>
- An interesting thing to note in the above example is the use of the
- <literal>RuntimeConfig</literal> object. External resources like a <literal>TransactionManager</literal>
- and a JGroups <literal>ChannelFactory</literal> that are visible to the microcontainer are dependency injected
- into the <literal>RuntimeConfig</literal>. The assumption here is that in some other deployment descriptor in
- the AS, the referenced beans have already been described.
- </para>
+ For detailed information on how to deploy JBoss Cache instances this way,
+ please check section "11.2. Deploying Your Own JBoss Cache Instance" and more
+ specifically, section "11.2.3. Deployment Via a -jboss-beans.xml File" in the
+ <ulink url="http://jboss.org/file-access/default/members/jbossclustering/freezone/doc...">
+ JBoss Application Server 5 Clustering Guide</ulink>.
+ </para>
+
</section>
<section>
<title>Automatic binding to JNDI in JBoss AS</title>
<para>
- This feature is not available as of the time of this writing. We will
- add a wiki page describing how to use it once it becomes available.
+ Although access to cache instances bound to JNDI is not possible, JBoss Application
+ Server 5 binds a CacheManager to JNDI which can be looked up and from where cache
+ instances can be retrieved. Further detailed information can be found in section
+ "11.2.1. Deployment Via the CacheManager Service" in the
+ <ulink url="http://jboss.org/file-access/default/members/jbossclustering/freezone/doc...">
+ JBoss Application Server 5 Clustering Guide</ulink>.
</para>
</section>
15 years, 4 months
JBoss Cache SVN: r8165 - 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-08-07 06:03:27 -0400 (Fri, 07 Aug 2009)
New Revision: 8165
Added:
core/trunk/src/main/resources/schema/jbosscache-config-3.2.xsd
core/trunk/src/main/resources/schema/jbosscache-registry-3.2.xsd
Modified:
core/trunk/src/main/docbook/userguide/en/modules/configuration.xml
core/trunk/src/main/docbook/userguide/en/modules/configuration_reference.xml
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/resources/config-samples/all.xml
core/trunk/src/main/resources/config-samples/buddy-replication.xml
core/trunk/src/main/resources/config-samples/cacheloader-enabled.xml
core/trunk/src/main/resources/config-samples/eviction-enabled.xml
core/trunk/src/main/resources/config-samples/external-jgroups-file.xml
core/trunk/src/main/resources/config-samples/invalidation-async.xml
core/trunk/src/main/resources/config-samples/local.xml
core/trunk/src/main/resources/config-samples/multiplexer-enabled.xml
core/trunk/src/main/resources/config-samples/non-blocking-state-transfer.xml
core/trunk/src/main/resources/config-samples/string-property-replaced.xml
core/trunk/src/main/resources/config-samples/total-replication.xml
core/trunk/src/main/resources/config2to3.xslt
core/trunk/src/test/resources/configs/buddy-replication-cache.xml
core/trunk/src/test/resources/configs/clonable-config.xml
core/trunk/src/test/resources/configs/local-lru-eviction.xml
core/trunk/src/test/resources/configs/local-passivation.xml
core/trunk/src/test/resources/configs/local-tx.xml
core/trunk/src/test/resources/configs/mixedPolicy-eviction.xml
core/trunk/src/test/resources/configs/mux.xml
core/trunk/src/test/resources/configs/mvcc-repl-sync-br.xml
core/trunk/src/test/resources/configs/parser-test-async.xml
core/trunk/src/test/resources/configs/parser-test.xml
core/trunk/src/test/resources/configs/policyPerRegion-eviction.xml
core/trunk/src/test/resources/configs/replSync.xml
core/trunk/src/test/resources/configs/string-property-replaced.xml
core/trunk/src/test/resources/jbc3-registry-configs.xml
core/trunk/src/test/resources/unit-test-cache-service.xml
Log:
Updated version on config schema and sample files, docs. Also made schema version management simpler in XML parsers
Modified: core/trunk/src/main/docbook/userguide/en/modules/configuration.xml
===================================================================
--- core/trunk/src/main/docbook/userguide/en/modules/configuration.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/docbook/userguide/en/modules/configuration.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -51,7 +51,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
+ xmlns="urn:jboss:jbosscache-core:config:3.2">
</jbosscache>
Modified: core/trunk/src/main/docbook/userguide/en/modules/configuration_reference.xml
===================================================================
--- core/trunk/src/main/docbook/userguide/en/modules/configuration_reference.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/docbook/userguide/en/modules/configuration_reference.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -10,7 +10,7 @@
<programlisting role="XML"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<!--
@@ -335,8 +335,8 @@
<row>
<entry><emphasis role="bold">xmlns</emphasis></entry>
<entry> - </entry>
- <entry>urn:jboss:jbosscache-core:config:3.1</entry>
- <entry>urn:jboss:jbosscache-core:config:3.1</entry>
+ <entry>urn:jboss:jbosscache-core:config:3.2</entry>
+ <entry>urn:jboss:jbosscache-core:config:3.2</entry>
<entry>Defines the XML namespace for all configuration entries.</entry>
</row>
<row>
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-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/RootElementBuilder.java 2009-08-07 10:03:27 UTC (rev 8165)
@@ -34,10 +34,13 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ArrayList;
/**
- * Parses an xml files and validates xml elements form {@link RootElementBuilder#JBOSSCACHE_CORE_NS_31} namespace
- * according to the configured schema.
+ * Parses an xml files and validates xml elements.
*
* @author Mircea.Markus(a)jboss.com
* @since 3.0
@@ -47,18 +50,25 @@
private static final JBossEntityResolver resolver = new JBossEntityResolver();
- 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";
+ public static final Map<String, String> ALLOWED_CORE_NAMESPACES = new HashMap<String, String>(4, 1f);
+ public static final Map<String, String> ALLOWED_REPO_NAMESPACES = new HashMap<String, String>(4, 1f);
+ public static final String DEFAULT_CORE_NS = "urn:jboss:jbosscache-core:config:3.2";
+ public static final String DEFAULT_REPO_NS = "urn:jboss:jbosscache-core:cache-repo:3.2";
+
static
{
- // Globally register this namespace
- 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");
+ ALLOWED_CORE_NAMESPACES.put("urn:jboss:jbosscache-core:config:3.2", "jbosscache-config-3.2.xsd");
+ ALLOWED_CORE_NAMESPACES.put("urn:jboss:jbosscache-core:config:3.1", "jbosscache-config-3.1.xsd");
+ ALLOWED_CORE_NAMESPACES.put("urn:jboss:jbosscache-core:config:3.0", "jbosscache-config-3.0.xsd");
+
+ ALLOWED_REPO_NAMESPACES.put("urn:jboss:jbosscache-core:cache-repo:3.2", "jbosscache-registry-3.2.xsd");
+ ALLOWED_REPO_NAMESPACES.put("urn:jboss:jbosscache-core:cache-repo:3.1", "jbosscache-registry-3.1.xsd");
+ ALLOWED_REPO_NAMESPACES.put("urn:jboss:jbosscache-core:cache-repo:3.0", "jbosscache-registry-3.0.xsd");
+
+ // Globally register the namespaces
+ for (Map.Entry<String, String> entry: ALLOWED_CORE_NAMESPACES.entrySet()) JBossEntityResolver.registerEntity(entry.getKey(), entry.getValue());
+ for (Map.Entry<String, String> entry: ALLOWED_REPO_NAMESPACES.entrySet()) JBossEntityResolver.registerEntity(entry.getKey(), entry.getValue());
}
private static final Log log = LogFactory.getLog(RootElementBuilder.class);
@@ -87,6 +97,14 @@
{
this(new FailureErrorHandler(), validating);
}
+
+ private String[] namespaces()
+ {
+ List<String> ns = new ArrayList<String>(ALLOWED_CORE_NAMESPACES.size() + ALLOWED_REPO_NAMESPACES.size());
+ for (String candidate: ALLOWED_CORE_NAMESPACES.keySet()) ns.add(candidate);
+ for (String candidate: ALLOWED_REPO_NAMESPACES.keySet()) ns.add(candidate);
+ return ns.toArray(new String[ns.size()]);
+ }
public Element readRoot(InputStream config)
{
@@ -98,8 +116,7 @@
{
docBuilderFactory.setValidating(true);
docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
- 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});
+ docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", namespaces());
}
DocumentBuilder parser = docBuilderFactory.newDocumentBuilder();
parser.setEntityResolver(resolver);
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-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigHelper.java 2009-08-07 10:03:27 UTC (rev 8165)
@@ -391,7 +391,7 @@
*/
public static Element stringToElementInCoreNS(String xml) throws Exception
{
- xml = "<wrapper xmlns='" + RootElementBuilder.JBOSSCACHE_CORE_NS_31 + "'>" + xml + "</wrapper>";
+ xml = "<wrapper xmlns='" + RootElementBuilder.DEFAULT_CORE_NS + "'>" + 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-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlConfigurationParser.java 2009-08-07 10:03:27 UTC (rev 8165)
@@ -31,7 +31,6 @@
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.JGroupsStackParser;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.util.FileLookup;
import org.w3c.dom.Element;
@@ -144,16 +143,14 @@
private Configuration processElements(boolean ignoreRoot)
{
coreNamespace = root.getNamespaceURI();
- if (coreNamespace == null) coreNamespace = RootElementBuilder.JBOSSCACHE_CORE_NS_31; // use the default
+ if (coreNamespace == null) coreNamespace = RootElementBuilder.DEFAULT_CORE_NS; // use the default
if (!ignoreRoot &&
- (!"jbosscache".equals(root.getLocalName()) ||
- (!RootElementBuilder.JBOSSCACHE_CORE_NS_31.equals(coreNamespace) &&
- !RootElementBuilder.JBOSSCACHE_CORE_NS_30.equals(coreNamespace))
- ))
+ (!"jbosscache".equals(root.getLocalName()) || !isAllowedCoreNamespace(coreNamespace))
+ )
{
- throw new ConfigurationException("Expected root element <jbosscache />" + (isValidating() ? " in either {" +
- RootElementBuilder.JBOSSCACHE_CORE_NS_30 + "} or {" + RootElementBuilder.JBOSSCACHE_CORE_NS_31 + "} namespaces" : ""));
+ throw new ConfigurationException("Expected root element <jbosscache />" + (isValidating() ? " in either of " + getAllowedCoreNamespaces()
+ + " namespaces" : ""));
}
try
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-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/XmlParserBase.java 2009-08-07 10:03:27 UTC (rev 8165)
@@ -22,10 +22,13 @@
package org.jboss.cache.config.parsing;
import org.jboss.cache.config.LegacyConfigurationException;
+import org.jboss.cache.util.Immutables;
import org.jboss.util.StringPropertyReplacer;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
+import java.util.List;
+
/**
* Contains utility methods that might be useful to most of the parsers.
*
@@ -107,4 +110,16 @@
String name = e.getNodeName();
if ("config".equals(name)) throw new LegacyConfigurationException("Legacy element encountered when using parser " + getClass().getSimpleName());
}
+
+ protected boolean isAllowedCoreNamespace(String namespace) {
+ for (String ns: RootElementBuilder.ALLOWED_CORE_NAMESPACES.keySet())
+ {
+ if (ns.equals(namespace)) return true;
+ }
+ return false;
+ }
+
+ protected List<String> getAllowedCoreNamespaces() {
+ return Immutables.immutableListConvert(RootElementBuilder.ALLOWED_CORE_NAMESPACES.keySet());
+ }
}
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-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/BuddyElementParser.java 2009-08-07 10:03:27 UTC (rev 8165)
@@ -44,7 +44,7 @@
{
public BuddyElementParser()
{
- this(RootElementBuilder.JBOSSCACHE_CORE_NS_31);
+ this(RootElementBuilder.DEFAULT_CORE_NS);
}
public BuddyElementParser(String coreNamespace)
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-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/CustomInterceptorsElementParser.java 2009-08-07 10:03:27 UTC (rev 8165)
@@ -49,7 +49,7 @@
{
public CustomInterceptorsElementParser()
{
- this(RootElementBuilder.JBOSSCACHE_CORE_NS_31);
+ this(RootElementBuilder.DEFAULT_CORE_NS);
}
public CustomInterceptorsElementParser(String coreNamespace)
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-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/EvictionElementParser.java 2009-08-07 10:03:27 UTC (rev 8165)
@@ -52,7 +52,7 @@
{
public EvictionElementParser()
{
- this(RootElementBuilder.JBOSSCACHE_CORE_NS_31);
+ this(RootElementBuilder.DEFAULT_CORE_NS);
}
public EvictionElementParser(String coreNamespace)
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-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/element/LoadersElementParser.java 2009-08-07 10:03:27 UTC (rev 8165)
@@ -45,7 +45,7 @@
{
public LoadersElementParser()
{
- this(RootElementBuilder.JBOSSCACHE_CORE_NS_31);
+ this(RootElementBuilder.DEFAULT_CORE_NS);
}
public LoadersElementParser(String coreNamespace)
Modified: core/trunk/src/main/resources/config-samples/all.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/all.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/resources/config-samples/all.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<!--
Modified: core/trunk/src/main/resources/config-samples/buddy-replication.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/buddy-replication.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/resources/config-samples/buddy-replication.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
Modified: core/trunk/src/main/resources/config-samples/cacheloader-enabled.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/cacheloader-enabled.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/resources/config-samples/cacheloader-enabled.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,5 +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.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<!-- Configure the TransactionManager -->
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
Modified: core/trunk/src/main/resources/config-samples/eviction-enabled.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/eviction-enabled.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/resources/config-samples/eviction-enabled.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,5 +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.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<!-- Configure the TransactionManager -->
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
Modified: core/trunk/src/main/resources/config-samples/external-jgroups-file.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/external-jgroups-file.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/resources/config-samples/external-jgroups-file.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,5 +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.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<!-- Configure the TransactionManager -->
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
Modified: core/trunk/src/main/resources/config-samples/invalidation-async.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/invalidation-async.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/resources/config-samples/invalidation-async.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<!-- Configure the TransactionManager -->
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
Modified: core/trunk/src/main/resources/config-samples/local.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/local.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/resources/config-samples/local.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<!-- By not specifying the 'clustering' element, the cache runs in LOCAL mode. -->
<!-- Configure the TransactionManager -->
Modified: core/trunk/src/main/resources/config-samples/multiplexer-enabled.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/multiplexer-enabled.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/resources/config-samples/multiplexer-enabled.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,5 +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.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<!-- Configure the TransactionManager -->
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
Modified: core/trunk/src/main/resources/config-samples/non-blocking-state-transfer.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/non-blocking-state-transfer.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/resources/config-samples/non-blocking-state-transfer.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<clustering mode="replication">
<sync />
<stateRetrieval fetchInMemoryState="true" nonBlocking="true" timeout="60000" />
Modified: core/trunk/src/main/resources/config-samples/string-property-replaced.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/string-property-replaced.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/resources/config-samples/string-property-replaced.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,5 +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.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<locking lockAcquisitionTimeout="${test.property.LockAcquisitionTimeout:15000}"
nodeLockingScheme="${test.property.NodeLockingScheme:MVCC}"/>
Modified: core/trunk/src/main/resources/config-samples/total-replication.xml
===================================================================
--- core/trunk/src/main/resources/config-samples/total-replication.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/resources/config-samples/total-replication.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<!-- Configure the TransactionManager -->
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
Modified: core/trunk/src/main/resources/config2to3.xslt
===================================================================
--- core/trunk/src/main/resources/config2to3.xslt 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/main/resources/config2to3.xslt 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet xmlns="urn:jboss:jbosscache-core:config:3.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:stylesheet xmlns="urn:jboss:jbosscache-core:config:3.2" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" version="1.0" encoding="UTF-8" omit-xml-declaration="no"/>
<xsl:template match="/">
<xsl:element name="jbosscache">
Copied: core/trunk/src/main/resources/schema/jbosscache-config-3.2.xsd (from rev 8163, core/trunk/src/main/resources/schema/jbosscache-config-3.1.xsd)
===================================================================
--- core/trunk/src/main/resources/schema/jbosscache-config-3.2.xsd (rev 0)
+++ core/trunk/src/main/resources/schema/jbosscache-config-3.2.xsd 2009-08-07 10:03:27 UTC (rev 8165)
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
+ xmlns:tns="urn:jboss:jbosscache-core:config:3.2" targetNamespace="urn:jboss:jbosscache-core:config:3.2"
+ 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="useLockStriping" 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:attribute name="nonBlocking" type="tns:booleanType" />
+ </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>
+
Copied: core/trunk/src/main/resources/schema/jbosscache-registry-3.2.xsd (from rev 8163, core/trunk/src/main/resources/schema/jbosscache-registry-3.1.xsd)
===================================================================
--- core/trunk/src/main/resources/schema/jbosscache-registry-3.2.xsd (rev 0)
+++ core/trunk/src/main/resources/schema/jbosscache-registry-3.2.xsd 2009-08-07 10:03:27 UTC (rev 8165)
@@ -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.2"
+ xmlns:repo="urn:jboss:jbosscache-core:cache-repo:3.2"
+ targetNamespace="urn:jboss:jbosscache-core:cache-repo:3.2"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
+ <xs:import schemaLocation="jbosscache-config-3.2.xsd" namespace="urn:jboss:jbosscache-core:config:3.2"/>
+
+ <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/resources/configs/buddy-replication-cache.xml
===================================================================
--- core/trunk/src/test/resources/configs/buddy-replication-cache.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/buddy-replication-cache.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
+ xmlns="urn:jboss:jbosscache-core:config:3.2">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
<clustering clusterName="JBossCache-Cluster">
Modified: core/trunk/src/test/resources/configs/clonable-config.xml
===================================================================
--- core/trunk/src/test/resources/configs/clonable-config.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/clonable-config.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
+ xmlns="urn:jboss:jbosscache-core:config:3.2">
<locking isolationLevel="SERIALIZABLE" lockAcquisitionTimeout="1" nodeLockingScheme="optimistic"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
<clustering clusterName="CloneCluster">
Modified: core/trunk/src/test/resources/configs/local-lru-eviction.xml
===================================================================
--- core/trunk/src/test/resources/configs/local-lru-eviction.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/local-lru-eviction.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
+ xmlns="urn:jboss:jbosscache-core:config:3.2">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
Modified: core/trunk/src/test/resources/configs/local-passivation.xml
===================================================================
--- core/trunk/src/test/resources/configs/local-passivation.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/local-passivation.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
+ xmlns="urn:jboss:jbosscache-core:config:3.2">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
Modified: core/trunk/src/test/resources/configs/local-tx.xml
===================================================================
--- core/trunk/src/test/resources/configs/local-tx.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/local-tx.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
+ xmlns="urn:jboss:jbosscache-core:config:3.2">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
Modified: core/trunk/src/test/resources/configs/mixedPolicy-eviction.xml
===================================================================
--- core/trunk/src/test/resources/configs/mixedPolicy-eviction.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/mixedPolicy-eviction.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
+ xmlns="urn:jboss:jbosscache-core:config:3.2">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="15000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
Modified: core/trunk/src/test/resources/configs/mux.xml
===================================================================
--- core/trunk/src/test/resources/configs/mux.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/mux.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,5 +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.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
<clustering>
<stateRetrieval timeout="20000"/>
Modified: core/trunk/src/test/resources/configs/mvcc-repl-sync-br.xml
===================================================================
--- core/trunk/src/test/resources/configs/mvcc-repl-sync-br.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/mvcc-repl-sync-br.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns="urn:jboss:jbosscache-core:config:3.1">
+<jbosscache xmlns="urn:jboss:jbosscache-core:config:3.2">
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
<clustering>
<stateRetrieval fetchInMemoryState="false"/>
Modified: core/trunk/src/test/resources/configs/parser-test-async.xml
===================================================================
--- core/trunk/src/test/resources/configs/parser-test-async.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/parser-test-async.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -3,7 +3,7 @@
<!-- file used for functional test of the xml parser -->
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
+ xmlns="urn:jboss:jbosscache-core:config:3.2">
<locking isolationLevel="REPEATABLE_READ" lockParentForChildInsertRemove="true" lockAcquisitionTimeout="10234"
Modified: core/trunk/src/test/resources/configs/parser-test.xml
===================================================================
--- core/trunk/src/test/resources/configs/parser-test.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/parser-test.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -3,7 +3,7 @@
<!-- file used for functional test of the xml parser -->
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:jboss:jbosscache-core:config:3.1">
+ xmlns="urn:jboss:jbosscache-core:config:3.2">
<!-- perCache -> differrent EntryFactory-->
<locking isolationLevel="REPEATABLE_READ" lockParentForChildInsertRemove="true" lockAcquisitionTimeout="10234"
Modified: core/trunk/src/test/resources/configs/policyPerRegion-eviction.xml
===================================================================
--- core/trunk/src/test/resources/configs/policyPerRegion-eviction.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/policyPerRegion-eviction.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,5 +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.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
<clustering clusterName="JBossCache-Cluster123" />
<eviction wakeUpInterval="5000">
Modified: core/trunk/src/test/resources/configs/replSync.xml
===================================================================
--- core/trunk/src/test/resources/configs/replSync.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/replSync.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,5 +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.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
<serialization useRegionBasedMarshalling="true"/>
Modified: core/trunk/src/test/resources/configs/string-property-replaced.xml
===================================================================
--- core/trunk/src/test/resources/configs/string-property-replaced.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/configs/string-property-replaced.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,5 +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.1">
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.2">
<locking lockAcquisitionTimeout="${test.property.LockAcquisitionTimeout:15000}"
nodeLockingScheme="${test.property.NodeLockingScheme:MVCC}"/>
Modified: core/trunk/src/test/resources/jbc3-registry-configs.xml
===================================================================
--- core/trunk/src/test/resources/jbc3-registry-configs.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/jbc3-registry-configs.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<registry:cache-configs xmlns="urn:jboss:jbosscache-core:config:3.1" xmlns:registry="urn:jboss:jbosscache-core:cache-repo:3.1">
+<registry:cache-configs xmlns="urn:jboss:jbosscache-core:config:3.2" xmlns:registry="urn:jboss:jbosscache-core:cache-repo:3.2">
<!--
Various JBoss Cache configurations, suitable for different caching
Modified: core/trunk/src/test/resources/unit-test-cache-service.xml
===================================================================
--- core/trunk/src/test/resources/unit-test-cache-service.xml 2009-08-07 09:27:48 UTC (rev 8164)
+++ core/trunk/src/test/resources/unit-test-cache-service.xml 2009-08-07 10:03:27 UTC (rev 8165)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns="urn:jboss:jbosscache-core:config:3.1">
+<jbosscache xmlns="urn:jboss:jbosscache-core:config:3.2">
<locking isolationLevel="REPEATABLE_READ" lockAcquisitionTimeout="10000"/>
<transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/>
<serialization useRegionBasedMarshalling="false"/>
15 years, 4 months
JBoss Cache SVN: r8164 - core/trunk/src/main/java/org/jboss/cache/commands/read.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-08-07 05:27:48 -0400 (Fri, 07 Aug 2009)
New Revision: 8164
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
Log:
Brian's patch to deal with invalid nodes
Modified: core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2009-08-06 12:06:01 UTC (rev 8163)
+++ core/trunk/src/main/java/org/jboss/cache/commands/read/GravitateDataCommand.java 2009-08-07 09:27:48 UTC (rev 8164)
@@ -29,6 +29,7 @@
import org.jboss.cache.InternalNode;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
+import org.jboss.cache.NodeNotValidException;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
@@ -170,10 +171,17 @@
}
else
{
- // make sure we LOAD data for this node!!
- actualNode.getData();
- // and children!
- actualNode.getChildrenNames();
+ try
+ {
+ actualNode.getData();
+ // and children!
+ actualNode.getChildrenNames();
+ }
+ catch (NodeNotValidException e)
+ {
+ if (trace) log.trace("Found node " + actualNode.getFqn() + " but it is not valid. Returning 'no data found'", e);
+ return GravitateResult.noDataFound();
+ }
}
if (backupNodeFqn == null && searchSubtrees)
15 years, 4 months
JBoss Cache SVN: r8163 - core/trunk/src/test/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-08-06 08:06:01 -0400 (Thu, 06 Aug 2009)
New Revision: 8163
Modified:
core/trunk/src/test/java/org/jboss/cache/marshall/VersionAwareMarshallerTest.java
Log:
Updated version test
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/VersionAwareMarshallerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/VersionAwareMarshallerTest.java 2009-08-06 11:21:03 UTC (rev 8162)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/VersionAwareMarshallerTest.java 2009-08-06 12:06:01 UTC (rev 8163)
@@ -78,7 +78,7 @@
byte[] bytes = marshaller.objectToByteBuffer("Hello");
ObjectInputStream in = new MarshalledValueInputStream(new ByteArrayInputStream(bytes));
- assertEquals("Version header short should be '30'", 31, in.readShort());
+ assertEquals("Version header short should be '32'", 32, in.readShort());
}
public void testVersionHeader210() throws Exception
15 years, 4 months
JBoss Cache SVN: r8162 - in core/trunk/src: main/java/org/jboss/cache/invocation and 5 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-08-06 07:21:03 -0400 (Thu, 06 Aug 2009)
New Revision: 8162
Added:
core/trunk/src/main/java/org/jboss/cache/invocation/CacheNotReadyException.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationFromDyingNodeTest.java
Modified:
core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
core/trunk/src/test/java/org/jboss/cache/notifications/NotifierTest.java
Log:
JBCACHE-1528 - Data gravitation prefers exception response over valid gravitation
Modified: core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2009-08-06 10:10:12 UTC (rev 8161)
+++ core/trunk/src/main/java/org/jboss/cache/factories/ComponentRegistry.java 2009-08-06 11:21:03 UTC (rev 8162)
@@ -872,16 +872,16 @@
* this method will block for up to {@link org.jboss.cache.config.Configuration#getStateRetrievalTimeout()} millis, checking
* for a valid state.
*
- * @param originLocal true if the call originates locally (i.e., from the {@link org.jboss.cache.invocation.CacheInvocationDelegate} or false if it originates remotely, i.e., from the {@link org.jboss.cache.marshall.CommandAwareRpcDispatcher}.
+ * @param SkipBlockUntilStart true if the call should not wait for the cache to start (typical local use) and false if we should try and wait (typical remote lookup use)
* @return true if invocations are allowed, false otherwise.
*/
- public boolean invocationsAllowed(boolean originLocal)
+ public boolean invocationsAllowed(boolean SkipBlockUntilStart)
{
if (trace) log.trace("Testing if invocations are allowed.");
if (state.allowInvocations()) return true;
// if this is a locally originating call and the cache is not in a valid state, return false.
- if (originLocal) return false;
+ if (SkipBlockUntilStart) return false;
if (trace) log.trace("Is remotely originating.");
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2009-08-06 10:10:12 UTC (rev 8161)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2009-08-06 11:21:03 UTC (rev 8162)
@@ -690,9 +690,9 @@
protected void cacheStatusCheck(InvocationContext ctx)
{
assertIsConstructed();
- if (!ctx.getOptionOverrides().isSkipCacheStatusCheck() && !componentRegistry.invocationsAllowed(ctx.isOriginLocal()))
+ if (!ctx.getOptionOverrides().isSkipCacheStatusCheck() && !componentRegistry.invocationsAllowed(true)) // this should always be true since we should never wait for the cache to start at this stage
{
- throw new IllegalStateException("Cache not in STARTED state!");
+ throw new CacheNotReadyException("Cache not in a valid STARTED state! Cache state is " + componentRegistry.getState());
}
}
@@ -704,16 +704,4 @@
command.setErase(erase);
invoker.invoke(ctx, command);
}
-
-
- // TODO: Add these to the public interface in 3.1.0.
- public void setData(Fqn fqn, Map<? extends K, ? extends V> data)
- {
- invokePut(fqn, data, true);
- }
-
- public void setData(String fqn, Map<? extends K, ? extends V> data)
- {
- setData(Fqn.fromString(fqn), data);
- }
}
Added: core/trunk/src/main/java/org/jboss/cache/invocation/CacheNotReadyException.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheNotReadyException.java (rev 0)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheNotReadyException.java 2009-08-06 11:21:03 UTC (rev 8162)
@@ -0,0 +1,24 @@
+package org.jboss.cache.invocation;
+
+/**
+ * Thrown when a cache is in an invalid state
+ *
+ * @author Manik Surtani
+ * @since 3.2
+ */
+public class CacheNotReadyException extends IllegalStateException {
+ public CacheNotReadyException() {
+ }
+
+ public CacheNotReadyException(String s) {
+ super(s);
+ }
+
+ public CacheNotReadyException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public CacheNotReadyException(Throwable cause) {
+ super(cause);
+ }
+}
Property changes on: core/trunk/src/main/java/org/jboss/cache/invocation/CacheNotReadyException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java 2009-08-06 10:10:12 UTC (rev 8161)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CommandAwareRpcDispatcher.java 2009-08-06 11:21:03 UTC (rev 8162)
@@ -36,6 +36,7 @@
import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.interceptors.InterceptorChain;
import org.jboss.cache.invocation.InvocationContextContainer;
+import org.jboss.cache.invocation.CacheNotReadyException;
import org.jboss.cache.util.concurrent.BoundedExecutors;
import org.jboss.cache.util.concurrent.WithinThreadExecutor;
import org.jgroups.Address;
@@ -294,7 +295,17 @@
{
return new RequestIgnoredResponse();
}
- ret = interceptorChain.invoke(ctx, (VisitableCommand) cmd);
+ try
+ {
+ ret = interceptorChain.invoke(ctx, (VisitableCommand) cmd);
+ }
+ catch (CacheNotReadyException cnre)
+ {
+ // this could happen, even though we check the state earlier on. There is still a window
+ // for the cache to be shut down in the meanwhile.
+ if (log.isDebugEnabled()) log.debug("Cache not in a state to respond!", cnre);
+ return new RequestIgnoredResponse();
+ }
}
else
{
Modified: core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2009-08-06 10:10:12 UTC (rev 8161)
+++ core/trunk/src/main/java/org/jboss/cache/notifications/NotifierImpl.java 2009-08-06 11:21:03 UTC (rev 8162)
@@ -527,18 +527,36 @@
/**
* Notifies all registered listeners of a cacheStopped event.
*/
- @Stop(priority = 98)
- public void notifyCacheStopped()
+ @Stop(priority = 999)
+ public void notifyCacheStoppedPost()
{
if (!cacheStoppedListeners.isEmpty())
{
EventImpl e = new EventImpl();
e.setCache(cache);
e.setType(CACHE_STOPPED);
+ e.setPre(false);
for (ListenerInvocation listener : cacheStoppedListeners) listener.invoke(e);
}
}
+/**
+ * Notifies all registered listeners of a cacheStopped event.
+ */
+ @Stop(priority = 0)
+ public void notifyCacheStoppedPre()
+ {
+ if (!cacheStoppedListeners.isEmpty())
+ {
+ EventImpl e = new EventImpl();
+ e.setCache(cache);
+ e.setType(CACHE_STOPPED);
+ e.setPre(true);
+ for (ListenerInvocation listener : cacheStoppedListeners) listener.invoke(e);
+ }
+ }
+
+
public void notifyViewChange(final View newView, InvocationContext ctx)
{
if (!viewChangedListeners.isEmpty())
Modified: core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java 2009-08-06 10:10:12 UTC (rev 8161)
+++ core/trunk/src/main/java/org/jboss/cache/util/CachePrinter.java 2009-08-06 11:21:03 UTC (rev 8162)
@@ -44,11 +44,19 @@
* @param c cache to print
* @return a String representation of the cache
*/
- public static String printCacheDetails(Cache c)
+ public static String printCacheDetails(Cache... c)
{
- // internal cast
- DataContainer ci = ((CacheInvocationDelegate) c).getDataContainer();
- return ci.printDetails();
+ StringBuilder sb = new StringBuilder();
+ int i=1;
+ for (Cache cache: c)
+ {
+ // internal cast
+ sb.append("\n--- Cache").append(i++).append(" ---\n");
+ DataContainer ci = ((CacheInvocationDelegate) cache).getDataContainer();
+ sb.append(ci.printDetails());
+ sb.append("\n------------\n\n");
+ }
+ return sb.toString();
}
/**
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationFromDyingNodeTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationFromDyingNodeTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationFromDyingNodeTest.java 2009-08-06 11:21:03 UTC (rev 8162)
@@ -0,0 +1,116 @@
+package org.jboss.cache.buddyreplication;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.CacheSPI;
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jboss.cache.notifications.annotation.CacheStopped;
+import org.jboss.cache.notifications.annotation.NodeVisited;
+import org.jboss.cache.notifications.event.CacheStoppedEvent;
+import org.jboss.cache.notifications.event.NodeVisitedEvent;
+import org.jboss.cache.util.CachePrinter;
+import org.jboss.cache.util.TestingUtil;
+import org.testng.annotations.Test;
+
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
+@Test(testName = "buddyreplication.GravitationFromDyingNodeTest", groups = "functional")
+public class GravitationFromDyingNodeTest extends BuddyReplicationTestsBase {
+
+ static Log log = LogFactory.getLog(GravitationFromDyingNodeTest.class);
+
+ public void testGravitationFromDyingNode() throws Exception {
+ // this test starts 4 nodes, each with 2 backups.
+ // the data owner is stopped.
+ // the node with no backup requests state from the other 2.
+ // one of the other two should be shutting down, and the other should be slow to respond
+ // so that the illegal cache state exception is propagated to the caller
+ // this encapsulates what is seen in JBCACHE-1528
+
+ List<CacheSPI<Object, Object>> caches = createCaches(2, 4, false, true, false, true);
+ final CacheSPI c1 = caches.get(0), c2 = caches.get(1), c3 = caches.get(2), c4 = caches.get(3);
+
+ c1.put("/a/b/c", "k", "v");
+
+ System.out.println("BEFORE: " + CachePrinter.printCacheDetails(c1, c2, c3, c4));
+
+ // kill c1
+ c1.stop();
+
+ log.error("** Stopped C1!");
+
+ // now stop c2, but make sure it takes time to shut down.
+ final StopListener sl = new StopListener();
+ c2.addCacheListener(sl);
+
+ final GetNodeListener gnl = new GetNodeListener();
+ c3.addCacheListener(gnl);
+
+ Thread stopper = new Thread("Stopper") {
+ @Override
+ public void run() {
+ log.error("** Stopping C2!");
+ c2.stop();
+ log.error("** Stopped C2!");
+ }
+ };
+
+ stopper.start();
+
+ Thread gateOpener = new Thread("GateOpener") {
+ @Override
+ public void run() {
+ TestingUtil.sleepThread(1000); // Yuk
+ log.error("** Opening gates!!");
+ sl.openGate();
+ gnl.openGate();
+ }
+ };
+
+ gateOpener.start();
+ log.error("** Starting gravitation!");
+ c4.getInvocationContext().getOptionOverrides().setForceDataGravitation(true);
+ assert null != c4.getNode("/a/b/c");
+ }
+
+ static abstract class GatedListener {
+ CountDownLatch gate = new CountDownLatch(1);
+
+ public void openGate() {
+ gate.countDown();
+ }
+
+ void waitForGate() {
+ try {
+ gate.await();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @CacheListener
+ public static class StopListener extends GatedListener {
+
+ @CacheStopped
+ public void stop(CacheStoppedEvent e) {
+ if (e.isPre()) {
+ log.error("** Waiting on gate to stop C2!");
+ waitForGate();
+ }
+ }
+ }
+
+ @CacheListener
+ public static class GetNodeListener extends GatedListener {
+
+ @NodeVisited
+ public void visit(NodeVisitedEvent e) {
+ if (e.isPre()) {
+ log.error("** Waiting on gate to read C3!");
+ waitForGate();
+ }
+ }
+ }
+}
Property changes on: core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationFromDyingNodeTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/NotifierTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/NotifierTest.java 2009-08-06 10:10:12 UTC (rev 8161)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/NotifierTest.java 2009-08-06 11:21:03 UTC (rev 8162)
@@ -164,14 +164,24 @@
assert allEventsListener.cacheStartedEvent.getType() == Event.Type.CACHE_STARTED;
}
- public void testNotifyCacheStopped()
+ public void testNotifyCacheStoppedPre()
{
assert allEventsListener.cacheStoppedEvent == null;
- notifier.notifyCacheStopped();
+ notifier.notifyCacheStoppedPre();
assert allEventsListener.cacheStoppedEvent != null;
assert allEventsListener.cacheStoppedEvent.getType() == Event.Type.CACHE_STOPPED;
+ assert allEventsListener.cacheStoppedEvent.isPre();
}
+ public void testNotifyCacheStoppedPost()
+ {
+ assert allEventsListener.cacheStoppedEvent == null;
+ notifier.notifyCacheStoppedPost();
+ assert allEventsListener.cacheStoppedEvent != null;
+ assert allEventsListener.cacheStoppedEvent.getType() == Event.Type.CACHE_STOPPED;
+ assert !allEventsListener.cacheStoppedEvent.isPre();
+ }
+
public void testNotifyViewChange()
{
assert allEventsListener.viewChanged == null;
15 years, 4 months
JBoss Cache SVN: r8161 - core/trunk/src/main/java/org/jboss/cache/invocation.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2009-08-06 06:10:12 -0400 (Thu, 06 Aug 2009)
New Revision: 8161
Modified:
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
Log:
Proper use of local origin flag
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2009-08-06 10:09:35 UTC (rev 8160)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2009-08-06 10:10:12 UTC (rev 8161)
@@ -690,7 +690,7 @@
protected void cacheStatusCheck(InvocationContext ctx)
{
assertIsConstructed();
- if (!ctx.getOptionOverrides().isSkipCacheStatusCheck() && !componentRegistry.invocationsAllowed(true))
+ if (!ctx.getOptionOverrides().isSkipCacheStatusCheck() && !componentRegistry.invocationsAllowed(ctx.isOriginLocal()))
{
throw new IllegalStateException("Cache not in STARTED state!");
}
15 years, 4 months