[infinispan-commits] Infinispan SVN: r2576 - in branches/4.2.x/core/src: main/resources/config-samples and 3 other directories.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Fri Oct 22 10:19:17 EDT 2010


Author: manik.surtani at jboss.com
Date: 2010-10-22 10:19:17 -0400 (Fri, 22 Oct 2010)
New Revision: 2576

Added:
   branches/4.2.x/core/src/test/java/org/infinispan/config/SyncAsyncParsingTest.java
Modified:
   branches/4.2.x/core/src/main/java/org/infinispan/config/AbstractConfigurationBean.java
   branches/4.2.x/core/src/main/java/org/infinispan/config/Configuration.java
   branches/4.2.x/core/src/main/java/org/infinispan/config/ConfigurationValidatingVisitor.java
   branches/4.2.x/core/src/main/java/org/infinispan/config/InfinispanConfiguration.java
   branches/4.2.x/core/src/main/java/org/infinispan/config/JAXBUnmarshallable.java
   branches/4.2.x/core/src/main/resources/config-samples/all.xml
   branches/4.2.x/core/src/test/java/org/infinispan/config/ConfigurationValidationTest.java
   branches/4.2.x/core/src/test/java/org/infinispan/test/TestingUtil.java
   branches/4.2.x/core/src/test/resources/configs/named-cache-test.xml
Log:
ISPN-725 - Config validator should not allow a replication queue to be defined with DIST


Modified: branches/4.2.x/core/src/main/java/org/infinispan/config/AbstractConfigurationBean.java
===================================================================
--- branches/4.2.x/core/src/main/java/org/infinispan/config/AbstractConfigurationBean.java	2010-10-22 12:55:01 UTC (rev 2575)
+++ branches/4.2.x/core/src/main/java/org/infinispan/config/AbstractConfigurationBean.java	2010-10-22 14:19:17 UTC (rev 2576)
@@ -122,7 +122,7 @@
    }
 
    @Override
-   public void willUnmarshall() {
+   public void willUnmarshall(Object parent) {
       // default no-op
    }
 }

Modified: branches/4.2.x/core/src/main/java/org/infinispan/config/Configuration.java
===================================================================
--- branches/4.2.x/core/src/main/java/org/infinispan/config/Configuration.java	2010-10-22 12:55:01 UTC (rev 2575)
+++ branches/4.2.x/core/src/main/java/org/infinispan/config/Configuration.java	2010-10-22 14:19:17 UTC (rev 2576)
@@ -34,6 +34,7 @@
 import org.infinispan.util.Util;
 import org.infinispan.util.concurrent.IsolationLevel;
 import org.infinispan.CacheException;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
@@ -52,22 +53,21 @@
 import static org.infinispan.config.Configuration.CacheMode.*;
 
 /**
- * Encapsulates the configuration of a Cache. Configures the default cache which can be retrieved
- * via CacheManager.getCache(). These default settings are also used as a starting point when
- * configuring namedCaches, since the default settings are inherited by any named cache.
- * 
+ * Encapsulates the configuration of a Cache. Configures the default cache which can be retrieved via
+ * CacheManager.getCache(). These default settings are also used as a starting point when configuring namedCaches, since
+ * the default settings are inherited by any named cache.
+ *
  * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  * @author Vladimir Blagojevic
  * @author Galder Zamarreño
+ * @see <a href="../../../config.html#ce_infinispan_default">Configuration reference</a>
  * @since 4.0
- * 
- * @see <a href="../../../config.html#ce_infinispan_default">Configuration reference</a>
  */
 @SurvivesRestarts
 @XmlAccessorType(XmlAccessType.FIELD)
- at XmlType(propOrder={})
- at ConfigurationDoc(name="default")
-public class Configuration extends AbstractNamedCacheConfigurationBean {  
+ at XmlType(propOrder = {})
+ at ConfigurationDoc(name = "default")
+public class Configuration extends AbstractNamedCacheConfigurationBean {
 
    private static final long serialVersionUID = 5553791890144997466L;
 
@@ -76,7 +76,7 @@
    private GlobalConfiguration globalConfiguration;
 
    @XmlAttribute
-   @ConfigurationDoc(desc="Only used with the namedCache element, this attribute specifies the name of the cache.  Can be any String, but must be unique in a given configuration.")
+   @ConfigurationDoc(desc = "Only used with the namedCache element, this attribute specifies the name of the cache.  Can be any String, but must be unique in a given configuration.")
    protected String name;
 
 
@@ -119,7 +119,7 @@
 
    @XmlElement
    private DeadlockDetectionType deadlockDetection = new DeadlockDetectionType();
-   
+
    @XmlElement
    private QueryConfigurationBean indexing = new QueryConfigurationBean();
 
@@ -139,11 +139,11 @@
    }
 
    public void applyOverrides(Configuration overrides) {
-      OverrideConfigurationVisitor v1 =new OverrideConfigurationVisitor();
+      OverrideConfigurationVisitor v1 = new OverrideConfigurationVisitor();
       this.accept(v1);
-      OverrideConfigurationVisitor v2 =new OverrideConfigurationVisitor();
+      OverrideConfigurationVisitor v2 = new OverrideConfigurationVisitor();
       overrides.accept(v2);
-      v1.override(v2);      
+      v1.override(v2);
    }
 
    public void inject(ComponentRegistry cr) {
@@ -155,7 +155,6 @@
    // ------------------------------------------------------------------------------------------------------------
 
    /**
-    *
     * will be removed, please use {@link org.infinispan.manager.EmbeddedCacheManager#getGlobalConfiguration()}
     */
    @Deprecated
@@ -185,24 +184,24 @@
       return deadlockDetection.spinDuration;
    }
 
-   
+
    /**
-    * Time period that determines how often is lock acquisition attempted within maximum time 
-    * allowed to acquire a particular lock
-    * 
+    * Time period that determines how often is lock acquisition attempted within maximum time allowed to acquire a
+    * particular lock
+    *
     * @param eagerDeadlockSpinDuration
     */
    public void setDeadlockDetectionSpinDuration(long eagerDeadlockSpinDuration) {
       this.deadlockDetection.setSpinDuration(eagerDeadlockSpinDuration);
    }
-   
+
    public boolean isEnableDeadlockDetection() {
       return deadlockDetection.enabled;
    }
 
    /**
     * Toggle to enable/disable deadlock detection
-    * 
+    *
     * @param useEagerDeadlockDetection
     */
    public void setEnableDeadlockDetection(boolean useEagerDeadlockDetection) {
@@ -210,10 +209,9 @@
    }
 
    /**
-    * If true, a pool of shared locks is maintained for all entries that need to be locked.
-    * Otherwise, a lock is created per entry in the cache. Lock striping helps control memory
-    * footprint but may reduce concurrency in the system.
-    * 
+    * If true, a pool of shared locks is maintained for all entries that need to be locked. Otherwise, a lock is created
+    * per entry in the cache. Lock striping helps control memory footprint but may reduce concurrency in the system.
+    *
     * @param useLockStriping
     */
    public void setUseLockStriping(boolean useLockStriping) {
@@ -227,21 +225,20 @@
    public boolean isUnsafeUnreliableReturnValues() {
       return unsafe.unreliableReturnValues;
    }
-   
-   
-   
+
+
    /**
     * Toggle to enable/disable return value fetching
-    * 
+    *
     * @param unsafeUnreliableReturnValues
     */
    public void setUnsafeUnreliableReturnValues(boolean unsafeUnreliableReturnValues) {
       this.unsafe.setUnreliableReturnValues(unsafeUnreliableReturnValues);
    }
- 
+
    /**
     * Rehashing timeout
-    * 
+    *
     * @param rehashRpcTimeout
     */
    public void setRehashRpcTimeout(long rehashRpcTimeout) {
@@ -251,16 +248,17 @@
    public long getRehashRpcTimeout() {
       return clustering.hash.rehashRpcTimeout;
    }
+
    public boolean isWriteSkewCheck() {
       return locking.writeSkewCheck;
    }
 
    /**
-    * This setting is only applicable in the case of REPEATABLE_READ. When write skew check is set
-    * to false, if the writer at commit time discovers that the working entry and the underlying
-    * entry have different versions, the working entry will overwrite the underlying entry. If true,
-    * such version conflict - known as a write-skew - will throw an Exception.
-    * 
+    * This setting is only applicable in the case of REPEATABLE_READ. When write skew check is set to false, if the
+    * writer at commit time discovers that the working entry and the underlying entry have different versions, the
+    * working entry will overwrite the underlying entry. If true, such version conflict - known as a write-skew - will
+    * throw an Exception.
+    *
     * @param writeSkewCheck
     */
    public void setWriteSkewCheck(boolean writeSkewCheck) {
@@ -272,10 +270,9 @@
    }
 
    /**
-    * Concurrency level for lock containers. Adjust this value according to the number of concurrent
-    * threads interating with Infinispan. Similar to the concurrencyLevel tuning parameter seen in
-    * the JDK's ConcurrentHashMap.
-    * 
+    * Concurrency level for lock containers. Adjust this value according to the number of concurrent threads interating
+    * with Infinispan. Similar to the concurrencyLevel tuning parameter seen in the JDK's ConcurrentHashMap.
+    *
     * @param concurrencyLevel
     */
    public void setConcurrencyLevel(int concurrencyLevel) {
@@ -283,9 +280,9 @@
    }
 
    /**
-    * If useReplQueue is set to true, this attribute can be used to trigger flushing of the queue
-    * when it reaches a specific threshold.
-    * 
+    * If useReplQueue is set to true, this attribute can be used to trigger flushing of the queue when it reaches a
+    * specific threshold.
+    *
     * @param replQueueMaxElements
     */
    public void setReplQueueMaxElements(int replQueueMaxElements) {
@@ -293,10 +290,9 @@
    }
 
    /**
-    * If useReplQueue is set to true, this attribute controls how often the asynchronous thread used
-    * to flush the replication queue runs. This should be a positive integer which represents thread
-    * wakeup time in milliseconds.
-    * 
+    * If useReplQueue is set to true, this attribute controls how often the asynchronous thread used to flush the
+    * replication queue runs. This should be a positive integer which represents thread wakeup time in milliseconds.
+    *
     * @param replQueueInterval
     */
    public void setReplQueueInterval(long replQueueInterval) {
@@ -308,16 +304,16 @@
    }
 
    /**
-    * This overrides the replication queue implementation class. Overriding the default allows you
-    * to add behavior to the queue, typically by subclassing the default implementation.
-    * 
+    * This overrides the replication queue implementation class. Overriding the default allows you to add behavior to
+    * the queue, typically by subclassing the default implementation.
+    *
     * @param classname
     */
    public void setReplQueueClass(String classname) {
       this.clustering.async.setReplQueueClass(classname);
    }
 
-  
+
    public void setExposeJmxStatistics(boolean useMbean) {
       jmxStatistics.setEnabled(useMbean);
    }
@@ -328,6 +324,7 @@
     * end of batches.
     *
     * @param enabled if true, batching is enabled.
+    *
     * @since 4.0
     */
    public void setInvocationBatchingEnabled(boolean enabled) {
@@ -335,9 +332,9 @@
    }
 
    /**
-    * If true, this will cause the cache to ask neighboring caches for state when it starts up, so
-    * the cache starts 'warm', although it will impact startup time.
-    * 
+    * If true, this will cause the cache to ask neighboring caches for state when it starts up, so the cache starts
+    * 'warm', although it will impact startup time.
+    *
     * @param fetchInMemoryState
     */
    public void setFetchInMemoryState(boolean fetchInMemoryState) {
@@ -345,9 +342,9 @@
    }
 
    /**
-    * If true, this will allow the cache to provide in-memory state to a neighbor, even if the cache
-    * is not configured to fetch state from its neighbors (fetchInMemoryState is false)
-    * 
+    * If true, this will allow the cache to provide in-memory state to a neighbor, even if the cache is not configured
+    * to fetch state from its neighbors (fetchInMemoryState is false)
+    *
     * @param alwaysProvideInMemoryState
     */
    public void setAlwaysProvideInMemoryState(boolean alwaysProvideInMemoryState) {
@@ -356,7 +353,7 @@
 
    /**
     * Maximum time to attempt a particular lock acquisition
-    * 
+    *
     * @param lockAcquisitionTimeout
     */
    public void setLockAcquisitionTimeout(long lockAcquisitionTimeout) {
@@ -365,7 +362,7 @@
 
    /**
     * Maximum time to attempt a particular lock acquisition
-    * 
+    *
     * @param lockAcquisitionTimeout
     * @param timeUnit
     */
@@ -373,12 +370,11 @@
       setLockAcquisitionTimeout(timeUnit.toMillis(lockAcquisitionTimeout));
    }
 
-   
+
    /**
-    * 
-    * This is the timeout (in ms) used to wait for an acknowledgment when making a remote call, after which
-    * the call is aborted and an exception is thrown.
-    * 
+    * This is the timeout (in ms) used to wait for an acknowledgment when making a remote call, after which the call is
+    * aborted and an exception is thrown.
+    *
     * @param syncReplTimeout
     */
    public void setSyncReplTimeout(long syncReplTimeout) {
@@ -386,9 +382,9 @@
    }
 
    /**
-    * This is the timeout used to wait for an acknowledgment when making a remote call, after which
-    * the call is aborted and an exception is thrown.
-    * 
+    * This is the timeout used to wait for an acknowledgment when making a remote call, after which the call is aborted
+    * and an exception is thrown.
+    *
     * @param syncReplTimeout
     * @param timeUnit
     */
@@ -397,10 +393,9 @@
    }
 
    /**
-    * Cache mode. For distribution, set mode to either 'd', 'dist' or 'distribution'. For
-    * replication, use either 'r', 'repl' or 'replication'. Finally, for invalidation, 'i', 'inv' or
-    * 'invalidation'.
-    * 
+    * Cache mode. For distribution, set mode to either 'd', 'dist' or 'distribution'. For replication, use either 'r',
+    * 'repl' or 'replication'. Finally, for invalidation, 'i', 'inv' or 'invalidation'.
+    *
     * @param cacheMode
     */
    public void setCacheMode(CacheMode cacheModeInt) {
@@ -408,10 +403,9 @@
    }
 
    /**
-    * Cache mode. For distribution, set mode to either 'd', 'dist' or 'distribution'. For
-    * replication, use either 'r', 'repl' or 'replication'. Finally, for invalidation, 'i', 'inv' or
-    * 'invalidation'.
-    * 
+    * Cache mode. For distribution, set mode to either 'd', 'dist' or 'distribution'. For replication, use either 'r',
+    * 'repl' or 'replication'. Finally, for invalidation, 'i', 'inv' or 'invalidation'.
+    *
     * @param cacheMode
     */
    public void setCacheMode(String cacheMode) {
@@ -439,9 +433,9 @@
    }
 
    /**
-    * Interval between subsequent eviction runs, in milliseconds. If you wish to disable the
-    * periodic eviction process altogether, set wakeupInterval to -1.
-    * 
+    * Interval between subsequent eviction runs, in milliseconds. If you wish to disable the periodic eviction process
+    * altogether, set wakeupInterval to -1.
+    *
     * @param evictionWakeUpInterval
     */
    public void setEvictionWakeUpInterval(long evictionWakeUpInterval) {
@@ -453,9 +447,8 @@
    }
 
    /**
-    * Eviction strategy. Available options are 'UNORDERED', 'FIFO', 'LRU' and 'NONE' (to disable
-    * eviction).
-    * 
+    * Eviction strategy. Available options are 'UNORDERED', 'FIFO', 'LRU' and 'NONE' (to disable eviction).
+    *
     * @param evictionStrategy
     */
    public void setEvictionStrategy(EvictionStrategy evictionStrategy) {
@@ -463,9 +456,8 @@
    }
 
    /**
-    * Eviction strategy. Available options are 'UNORDERED', 'FIFO', 'LRU' and 'NONE' (to disable
-    * eviction).
-    * 
+    * Eviction strategy. Available options are 'UNORDERED', 'FIFO', 'LRU' and 'NONE' (to disable eviction).
+    *
     * @param eStrategy
     */
    public void setEvictionStrategy(String eStrategy) {
@@ -475,42 +467,41 @@
          this.eviction.setStrategy(EvictionStrategy.NONE);
       }
    }
-   
+
    public EvictionThreadPolicy getEvictionThreadPolicy() {
       return eviction.threadPolicy;
    }
-   
+
    /**
     * Threading policy for eviction.
-    * 
+    *
     * @param policy
     */
    public void setEvictionThreadPolicy(EvictionThreadPolicy policy) {
       this.eviction.setThreadPolicy(policy);
    }
-   
+
    /**
     * Threading policy for eviction.
-    * 
+    *
     * @param policy
     */
-   public void setEvictionThreadPolicy(String policy){
+   public void setEvictionThreadPolicy(String policy) {
       this.eviction.threadPolicy = EvictionThreadPolicy.valueOf(uc(policy));
       if (this.eviction.threadPolicy == null) {
          log.warn("Unknown thread eviction policy  '" + policy + "'!  Using EvictionThreadPolicy.DEFAULT");
          this.eviction.setThreadPolicy(EvictionThreadPolicy.DEFAULT);
       }
    }
-  
+
    public int getEvictionMaxEntries() {
       return eviction.maxEntries;
    }
 
    /**
-    * Maximum number of entries in a cache instance. If selected value is not a power of two the
-    * actual value will default to the least power of two larger than selected value. -1 means no
-    * limit.
-    * 
+    * Maximum number of entries in a cache instance. If selected value is not a power of two the actual value will
+    * default to the least power of two larger than selected value. -1 means no limit.
+    *
     * @param evictionMaxEntries
     */
    public void setEvictionMaxEntries(int evictionMaxEntries) {
@@ -524,13 +515,11 @@
       return expiration.lifespan;
    }
 
-  
+
    /**
-    * Maximum lifespan of a cache entry, after which the entry is expired cluster-wide, in
-    * milliseconds. -1 means the entries never expire. <br />
-    * <br />
-    * Note that this can be overriden on a per-entry bassi by using the Cache API.
-    * 
+    * Maximum lifespan of a cache entry, after which the entry is expired cluster-wide, in milliseconds. -1 means the
+    * entries never expire. <br /> <br /> Note that this can be overriden on a per-entry bassi by using the Cache API.
+    *
     * @param expirationLifespan
     */
    public void setExpirationLifespan(long expirationLifespan) {
@@ -544,13 +533,12 @@
       return expiration.maxIdle;
    }
 
-    
+
    /**
-    * Maximum idle time a cache entry will be maintained in the cache, in milliseconds. If the idle
-    * time is exceeded, the entry will be expired cluster-wide. -1 means the entries never expire. <br />
-    * <br />
-    * Note that this can be overriden on a per-entry bassi by using the Cache API.
-    * 
+    * Maximum idle time a cache entry will be maintained in the cache, in milliseconds. If the idle time is exceeded,
+    * the entry will be expired cluster-wide. -1 means the entries never expire. <br /> <br /> Note that this can be
+    * overriden on a per-entry bassi by using the Cache API.
+    *
     * @param expirationMaxIdle
     */
    public void setExpirationMaxIdle(long expirationMaxIdle) {
@@ -558,12 +546,12 @@
    }
 
    /**
-    * Fully qualified class name of a class that looks up a reference to a
-    * {@link javax.transaction.TransactionManager}. The default provided is capable of locating the
-    * default TransactionManager in most popular Java EE systems, using a JNDI lookup.
-    * 
+    * Fully qualified class name of a class that looks up a reference to a {@link javax.transaction.TransactionManager}.
+    * The default provided is capable of locating the default TransactionManager in most popular Java EE systems, using
+    * a JNDI lookup.
+    *
     * @param transactionManagerLookupClass
-    * */
+    */
    public void setTransactionManagerLookupClass(String transactionManagerLookupClass) {
       this.transaction.setTransactionManagerLookupClass(transactionManagerLookupClass);
    }
@@ -577,24 +565,22 @@
    }
 
    /**
-    * If true, the cluster-wide commit phase in two-phase commit (2PC) transactions will be
-    * synchronous, so Infinispan will wait for responses from all nodes to which the commit was
-    * sent. Otherwise, the commit phase will be asynchronous. Keeping it as false improves
-    * performance of 2PC transactions, since any remote failures are trapped during the prepare
-    * phase anyway and appropriate rollbacks are issued.
-    * 
+    * If true, the cluster-wide commit phase in two-phase commit (2PC) transactions will be synchronous, so Infinispan
+    * will wait for responses from all nodes to which the commit was sent. Otherwise, the commit phase will be
+    * asynchronous. Keeping it as false improves performance of 2PC transactions, since any remote failures are trapped
+    * during the prepare phase anyway and appropriate rollbacks are issued.
+    *
     * @param syncCommitPhase
-    * */
+    */
    public void setSyncCommitPhase(boolean syncCommitPhase) {
       this.transaction.setSyncCommitPhase(syncCommitPhase);
    }
 
    /**
-    * If true, the cluster-wide rollback phase in two-phase commit (2PC) transactions will be
-    * synchronous, so Infinispan will wait for responses from all nodes to which the rollback was
-    * sent. Otherwise, the rollback phase will be asynchronous. Keeping it as false improves
-    * performance of 2PC transactions.
-    * 
+    * If true, the cluster-wide rollback phase in two-phase commit (2PC) transactions will be synchronous, so Infinispan
+    * will wait for responses from all nodes to which the rollback was sent. Otherwise, the rollback phase will be
+    * asynchronous. Keeping it as false improves performance of 2PC transactions.
+    *
     * @param syncRollbackPhase
     */
    public void setSyncRollbackPhase(boolean syncRollbackPhase) {
@@ -602,37 +588,34 @@
    }
 
    /**
-    * Only has effect for DIST mode and when useEagerLocking is set to true. When this is enabled,
-    * then only one node is locked in the cluster, disregarding numOwners config. On the opposite,
-    * if this is false, then on all cache.lock() calls numOwners RPCs are being performed. The node
-    * that gets locked is the main data owner, i.e. the node where data would reside if
-    * numOwners==1. If the node where the lock resides crashes, then the transaction is marked for
+    * Only has effect for DIST mode and when useEagerLocking is set to true. When this is enabled, then only one node is
+    * locked in the cluster, disregarding numOwners config. On the opposite, if this is false, then on all cache.lock()
+    * calls numOwners RPCs are being performed. The node that gets locked is the main data owner, i.e. the node where
+    * data would reside if numOwners==1. If the node where the lock resides crashes, then the transaction is marked for
     * rollback - data is in a consistent state, no fault tolerance.
-    * 
+    *
     * @param useEagerLocking
-    * 
-    */  
+    */
    public void setUseEagerLocking(boolean useEagerLocking) {
       this.transaction.setUseEagerLocking(useEagerLocking);
    }
 
    /**
-    * Only has effect for DIST mode and when useEagerLocking is set to true. When this is enabled, then only one node
-    * is locked in the cluster, disregarding numOwners config. On the opposite, if this is false, then on all cache.lock() calls
-    * numOwners RPCs are being performed. The node that gets locked is the main data owner, i.e. the node where data
-    * would reside if numOwners==1. If the node where the lock resides crashes, then the transaction is marked for rollback -
-    * data is in a consistent state, no fault tolerance.
-    * 
+    * Only has effect for DIST mode and when useEagerLocking is set to true. When this is enabled, then only one node is
+    * locked in the cluster, disregarding numOwners config. On the opposite, if this is false, then on all cache.lock()
+    * calls numOwners RPCs are being performed. The node that gets locked is the main data owner, i.e. the node where
+    * data would reside if numOwners==1. If the node where the lock resides crashes, then the transaction is marked for
+    * rollback - data is in a consistent state, no fault tolerance.
+    *
     * @param eagerLockSingleNode
-    */   
+    */
    public void setEagerLockSingleNode(boolean eagerLockSingleNode) {
       this.transaction.setEagerLockSingleNode(eagerLockSingleNode);
    }
 
    /**
-    * If true, this forces all async communications to be queued up and sent out periodically as a
-    * batch.
-    * 
+    * If true, this forces all async communications to be queued up and sent out periodically as a batch.
+    *
     * @param useReplQueue
     */
    public void setUseReplQueue(boolean useReplQueue) {
@@ -640,10 +623,10 @@
    }
 
    /**
-    * Cache isolation level. Infinispan only supports READ_COMMITTED or REPEATABLE_READ isolation
-    * levels. See <a href='http://en.wikipedia.org/wiki/Isolation_level'>http://en.wikipedia.org/wiki/Isolation_level</a> 
-    * for a discussion on isolation levels.
-    * 
+    * Cache isolation level. Infinispan only supports READ_COMMITTED or REPEATABLE_READ isolation levels. See <a
+    * href='http://en.wikipedia.org/wiki/Isolation_level'>http://en.wikipedia.org/wiki/Isolation_level</a> for a
+    * discussion on isolation levels.
+    *
     * @param isolationLevel
     */
    public void setIsolationLevel(IsolationLevel isolationLevel) {
@@ -651,9 +634,9 @@
    }
 
    /**
-    * This is the maximum amount of time - in milliseconds - to wait for state from neighboring
-    * caches, before throwing an exception and aborting startup.
-    * 
+    * This is the maximum amount of time - in milliseconds - to wait for state from neighboring caches, before throwing
+    * an exception and aborting startup.
+    *
     * @param stateRetrievalTimeout
     */
    public void setStateRetrievalTimeout(long stateRetrievalTimeout) {
@@ -665,9 +648,8 @@
    }
 
    /**
-    * This is the maximum amount of time to run a cluster-wide flush, to allow for syncing of
-    * transaction logs.
-    * 
+    * This is the maximum amount of time to run a cluster-wide flush, to allow for syncing of transaction logs.
+    *
     * @param logFlushTimeout
     */
    public void setStateRetrievalLogFlushTimeout(long logFlushTimeout) {
@@ -678,12 +660,11 @@
       this.clustering.stateRetrieval.setLogFlushTimeout(timeUnit.toMillis(logFlushTimeout));
    }
 
-   
+
    /**
-    * 
-    * This is the maximum number of non-progressing transaction log writes after which a brute-force
-    * flush approach is resorted to, to synchronize transaction logs.
-    * 
+    * This is the maximum number of non-progressing transaction log writes after which a brute-force flush approach is
+    * resorted to, to synchronize transaction logs.
+    *
     * @param maxNonProgressingLogWrites
     */
    public void setStateRetrievalMaxNonProgressingLogWrites(int maxNonProgressingLogWrites) {
@@ -692,7 +673,7 @@
 
    /**
     * Initial wait time when backing off before retrying state transfer retrieval
-    * 
+    *
     * @param initialRetryWaitTime
     */
    public void setStateRetrievalInitialRetryWaitTime(long initialRetryWaitTime) {
@@ -703,10 +684,10 @@
       setStateRetrievalInitialRetryWaitTime(timeUnit.toMillis(initialRetryWaitTime));
    }
 
-   
+
    /**
     * Wait time increase factor over successive state retrieval backoffs
-    * 
+    *
     * @param retryWaitTimeIncreaseFactor
     */
    public void setStateRetrievalRetryWaitTimeIncreaseFactor(int retryWaitTimeIncreaseFactor) {
@@ -715,7 +696,7 @@
 
    /**
     * Number of state retrieval retries before giving up and aborting startup.
-    * 
+    *
     * @param numRetries
     */
    public void setStateRetrievalNumRetries(int numRetries) {
@@ -730,14 +711,14 @@
          locking.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
       }
    }
-   
+
    public void setUseLazyDeserialization(boolean useLazyDeserialization) {
       lazyDeserialization.setEnabled(useLazyDeserialization);
    }
 
    /**
     * Toggle to enable/disable L1 cache.
-    * 
+    *
     * @param l1CacheEnabled
     */
    public void setL1CacheEnabled(boolean l1CacheEnabled) {
@@ -746,7 +727,7 @@
 
    /**
     * Maximum lifespan of an entry placed in the L1 cache.
-    * 
+    *
     * @param l1Lifespan
     */
    public void setL1Lifespan(long l1Lifespan) {
@@ -754,9 +735,8 @@
    }
 
    /**
-    * If true, entries removed due to a rehash will be moved to L1 rather than being removed
-    * altogether.
-    * 
+    * If true, entries removed due to a rehash will be moved to L1 rather than being removed altogether.
+    *
     * @param l1OnRehash
     */
    public void setL1OnRehash(boolean l1OnRehash) {
@@ -765,7 +745,7 @@
 
    /**
     * Fully qualified name of class providing consistent hash algorithm
-    * 
+    *
     * @param consistentHashClass
     */
    public void setConsistentHashClass(String consistentHashClass) {
@@ -774,7 +754,7 @@
 
    /**
     * Number of cluster-wide replicas for each cache entry.
-    * 
+    *
     * @param numOwners
     */
    public void setNumOwners(int numOwners) {
@@ -782,9 +762,8 @@
    }
 
    /**
-    * If false, no rebalancing or rehashing will take place when a new node joins the cluster or a
-    * node leaves
-    * 
+    * If false, no rebalancing or rehashing will take place when a new node joins the cluster or a node leaves
+    *
     * @param rehashEnabled
     */
    public void setRehashEnabled(boolean rehashEnabled) {
@@ -796,11 +775,9 @@
    }
 
    /**
-    * 
-    * If true, asynchronous marshalling is enabled which means that caller can return even quicker,
-    * but it can suffer from reordering of operations. You can find more information <a
-    * href=&quot;http://community.jboss.org/docs/DOC-15725&quot;>here</a>
-    * 
+    * If true, asynchronous marshalling is enabled which means that caller can return even quicker, but it can suffer
+    * from reordering of operations. You can find more information <a href=&quot;http://community.jboss.org/docs/DOC-15725&quot;>here</a>
+    *
     * @param useAsyncMarshalling
     */
    public void setUseAsyncMarshalling(boolean useAsyncMarshalling) {
@@ -808,9 +785,9 @@
    }
 
    /**
-    * If enabled, entries will be indexed when they are added to the cache. Indexes will be updated
-    * as entries change or are removed.
-    * 
+    * If enabled, entries will be indexed when they are added to the cache. Indexes will be updated as entries change or
+    * are removed.
+    *
     * @param enabled
     */
    public void setIndexingEnabled(boolean enabled) {
@@ -818,9 +795,9 @@
    }
 
    /**
-    * If true, only index changes made locally, ignoring remote changes. This is useful if indexes
-    * are shared across a cluster to prevent redundant indexing of updates.
-    * 
+    * If true, only index changes made locally, ignoring remote changes. This is useful if indexes are shared across a
+    * cluster to prevent redundant indexing of updates.
+    *
     * @param indexLocalOnly
     */
    public void setIndexLocalOnly(boolean indexLocalOnly) {
@@ -857,12 +834,13 @@
 
    /**
     * @return true if invocation batching is enabled.
+    *
     * @since 4.0
     */
    public boolean isInvocationBatchingEnabled() {
-      return invocationBatching.enabled ;
+      return invocationBatching.enabled;
    }
-   
+
    public boolean isIndexingEnabled() {
       return indexing.isEnabled();
    }
@@ -988,7 +966,7 @@
    //   OVERRIDDEN METHODS
    // ------------------------------------------------------------------------------------------------------------
 
-   public void accept(ConfigurationBeanVisitor v) {      
+   public void accept(ConfigurationBeanVisitor v) {
       clustering.accept(v);
       customInterceptors.accept(v);
       deadlockDetection.accept(v);
@@ -1059,7 +1037,7 @@
       try {
          Configuration dolly = (Configuration) super.clone();
          if (clustering != null) dolly.clustering = clustering.clone();
-         if (globalConfiguration!= null) dolly.globalConfiguration = globalConfiguration.clone();
+         if (globalConfiguration != null) dolly.globalConfiguration = globalConfiguration.clone();
          if (locking != null) dolly.locking = (LockingType) locking.clone();
          if (loaders != null) dolly.loaders = loaders.clone();
          if (transaction != null) dolly.transaction = (TransactionType) transaction.clone();
@@ -1075,7 +1053,7 @@
          if (indexing != null) dolly.indexing = indexing.clone();
          return dolly;
       } catch (CloneNotSupportedException e) {
-         throw new CacheException("Unexpected!",e);
+         throw new CacheException("Unexpected!", e);
       }
    }
 
@@ -1099,7 +1077,7 @@
     */
    public void setCustomInterceptors(List<CustomInterceptorConfig> customInterceptors) {
       this.customInterceptors.setCustomInterceptors(customInterceptors);
-   }  
+   }
 
    public void assertValid() throws ConfigurationException {
       // certain combinations are illegal, such as state transfer + DIST
@@ -1107,7 +1085,7 @@
          throw new ConfigurationException("Cache cannot use DISTRIBUTION mode and have fetchInMemoryState set to true.  Perhaps you meant to enable rehashing?");
 
       if (clustering.mode.isClustered() && (globalConfiguration.getTransportClass() == null || globalConfiguration.getTransportClass().length() == 0))
-         throw new ConfigurationException("Cache cannot use a clustered mode ("+clustering.mode+") mode and not define a transport!");
+         throw new ConfigurationException("Cache cannot use a clustered mode (" + clustering.mode + ") mode and not define a transport!");
    }
 
    public boolean isOnePhaseCommit() {
@@ -1115,45 +1093,46 @@
    }
 
    /**
-    * 
     * Defines transactional (JTA) characteristics of the cache.
-    * 
+    *
     * @see <a href="../../../config.html#ce_default_transaction">Configuration reference</a>
     */
    @XmlAccessorType(XmlAccessType.PROPERTY)
-   @ConfigurationDoc(name="transaction")
-   public static class TransactionType extends AbstractNamedCacheConfigurationBean{
-           
-      /** The serialVersionUID */
+   @ConfigurationDoc(name = "transaction")
+   public static class TransactionType extends AbstractNamedCacheConfigurationBean {
+
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = -3867090839830874603L;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setTransactionManagerLookupClass")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setTransactionManagerLookupClass")
       protected String transactionManagerLookupClass;
-      
+
       @XmlTransient
       protected TransactionManagerLookup transactionManagerLookup;
-            
-      @Dynamic            
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setSyncCommitPhase")
+
+      @Dynamic
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setSyncCommitPhase")
       protected Boolean syncCommitPhase = false;
-            
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setSyncRollbackPhase")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setSyncRollbackPhase")
       @Dynamic
       protected Boolean syncRollbackPhase = false;
-            
+
       @Dynamic
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setUseEagerLocking")
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setUseEagerLocking")
       protected Boolean useEagerLocking = false;
 
-      @Dynamic      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setEagerLockSingleNode")
+      @Dynamic
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setEagerLockSingleNode")
       protected Boolean eagerLockSingleNode = false;
 
-      
+
       public TransactionType(String transactionManagerLookupClass) {
          this.transactionManagerLookupClass = transactionManagerLookupClass;
       }
-      
+
       public void accept(ConfigurationBeanVisitor v) {
          v.visitTransactionType(this);
       }
@@ -1165,7 +1144,7 @@
       @XmlAttribute
       public void setTransactionManagerLookupClass(String transactionManagerLookupClass) {
          testImmutability("transactionManagerLookupClass");
-         this.transactionManagerLookupClass = transactionManagerLookupClass;         
+         this.transactionManagerLookupClass = transactionManagerLookupClass;
       }
 
       @XmlAttribute
@@ -1225,39 +1204,41 @@
       }
 
       @Override
-      public void willUnmarshall() {
+      public void willUnmarshall(Object parent) {
          // set the REAL default now!!
          // make sure we use the setter so that the change is registered for merging
          setTransactionManagerLookupClass(GenericTransactionManagerLookup.class.getName());
       }
    }
+
    /**
-    * 
     * Defines the local, in-VM locking and concurrency characteristics of the cache.
-    * 
+    *
     * @see <a href="../../../config.html#ce_default_locking">Configuration reference</a>
     */
    @XmlAccessorType(XmlAccessType.PROPERTY)
    @ConfigurationDoc(name = "locking")
-   public static class LockingType  extends AbstractNamedCacheConfigurationBean{
+   public static class LockingType extends AbstractNamedCacheConfigurationBean {
 
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = 8142143187082119506L;
-      
+
       @Dynamic
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setLockAcquisitionTimeout")
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setLockAcquisitionTimeout")
       protected Long lockAcquisitionTimeout = 10000L;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setIsolationLevel")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setIsolationLevel")
       protected IsolationLevel isolationLevel = IsolationLevel.READ_COMMITTED;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setWriteSkewCheck")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setWriteSkewCheck")
       protected Boolean writeSkewCheck = false;
-     
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setUseLockStriping")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setUseLockStriping")
       protected Boolean useLockStriping = true;
-            
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setConcurrencyLevel")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setConcurrencyLevel")
       protected Integer concurrencyLevel = 32;
 
       @XmlAttribute
@@ -1282,7 +1263,7 @@
          this.writeSkewCheck = writeSkewCheck;
       }
 
-     
+
       @XmlAttribute
       public void setUseLockStriping(Boolean useLockStriping) {
          testImmutability("useLockStriping");
@@ -1325,26 +1306,28 @@
          return result;
       }
    }
-   
+
    /**
     * Defines clustered characteristics of the cache.
-    * 
+    *
     * @see <a href="../../../config.html#ce_default_clustering">Configuration reference</a>
     */
    @XmlJavaTypeAdapter(ClusteringTypeAdapter.class)
    @XmlAccessorType(XmlAccessType.PROPERTY)
-   @XmlType(propOrder={})
+   @XmlType(propOrder = {})
    @ConfigurationDoc(name = "clustering")
    public static class ClusteringType extends AbstractNamedCacheConfigurationBean {
 
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = 4048135465543498430L;
-    
-      @XmlAttribute(name="mode")       
+
+      @XmlAttribute(name = "mode")
       protected String stringMode;
 
-      @XmlTransient      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setCacheMode")
+      @XmlTransient
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setCacheMode")
       protected CacheMode mode;
 
       @XmlElement
@@ -1391,12 +1374,12 @@
       }
 
       public void accept(ConfigurationBeanVisitor v) {
-          async.accept(v);
-          hash.accept(v);
-          l1.accept(v);
-          stateRetrieval.accept(v);
-          sync.accept(v);
-          v.visitClusteringType(this);
+         async.accept(v);
+         hash.accept(v);
+         l1.accept(v);
+         stateRetrieval.accept(v);
+         sync.accept(v);
+         v.visitClusteringType(this);
       }
 
       @Override
@@ -1430,7 +1413,7 @@
       }
 
       @Override
-      public void willUnmarshall() {
+      public void willUnmarshall(Object parent) {
          // set the REAL default now!!
          // must use the setter to ensure the change is registered on the bean
          setMode(DIST_SYNC);
@@ -1441,30 +1424,29 @@
 
       @Override
       public ClusteringType marshal(ClusteringType ct) throws Exception {
-         return ct;        
+         return ct;
       }
 
       @Override
       public ClusteringType unmarshal(ClusteringType ct) throws Exception {
-         if(ct.stringMode != null){
+         if (ct.stringMode != null) {
             String mode = ct.stringMode.toLowerCase();
-            if(mode.startsWith("r")){
-               if(ct.isSynchronous())
+            if (mode.startsWith("r")) {
+               if (ct.isSynchronous())
                   ct.setMode(REPL_SYNC);
-               else 
+               else
                   ct.setMode(REPL_ASYNC);
-            } else if (mode.startsWith("i")){
-               if(ct.isSynchronous())
+            } else if (mode.startsWith("i")) {
+               if (ct.isSynchronous())
                   ct.setMode(INVALIDATION_SYNC);
-               else 
+               else
                   ct.setMode(INVALIDATION_ASYNC);
-            } else if (mode.startsWith("d")){
-               if(ct.isSynchronous())
+            } else if (mode.startsWith("d")) {
+               if (ct.isSynchronous())
                   ct.setMode(DIST_SYNC);
-               else 
+               else
                   ct.setMode(DIST_ASYNC);
-            }
-            else {
+            } else {
                throw new ConfigurationException("Invalid clustering mode" + ct.stringMode);
             }
          }
@@ -1473,41 +1455,43 @@
    }
 
    /**
-    * If this element is present, all communications are asynchronous, in that whenever a thread
-    * sends a message sent over the wire, it does not wait for an acknowledgment before returning.
-    * This element is mutually exclusive with the  <code> &lt;sync /&gt;</code> element.<br />
-    * <br />
-    * Characteristics of this can be tuned here.
-    * 
+    * If this element is present, all communications are asynchronous, in that whenever a thread sends a message sent
+    * over the wire, it does not wait for an acknowledgment before returning. This element is mutually exclusive with
+    * the  <code> &lt;sync /&gt;</code> element.<br /> <br /> Characteristics of this can be tuned here.
+    *
     * @see <a href="../../../config.html#ce_clustering_async">Configuration reference</a>
-    * 
     */
    @XmlAccessorType(XmlAccessType.PROPERTY)
-   @ConfigurationDoc(name = "async",parentName="clustering")
+   @ConfigurationDoc(name = "async", parentName = "clustering")
    public static class AsyncType extends AbstractNamedCacheConfigurationBean {
 
       @XmlTransient
       private boolean readFromXml = false;
-      
-      /** The serialVersionUID */
+
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = -7726319188826197399L;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setUseReplQueue")
-      protected Boolean useReplQueue=false;
 
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setReplQueueMaxElements")
-      protected Integer replQueueMaxElements=1000;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setReplQueueInterval")
-      protected Long replQueueInterval=5000L;
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setUseReplQueue")
+      protected Boolean useReplQueue = false;
 
-    
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setUseAsyncMarshalling")
-      protected Boolean asyncMarshalling=false;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setReplQueueClass")
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setReplQueueMaxElements")
+      protected Integer replQueueMaxElements = 1000;
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setReplQueueInterval")
+      protected Long replQueueInterval = 5000L;
+
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setUseAsyncMarshalling")
+      protected Boolean asyncMarshalling = false;
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setReplQueueClass")
       protected String replQueueClass = ReplicationQueueImpl.class.getName();
 
+      @XmlTransient
+      private boolean unmarshalledFromXml = false;
+
       private AsyncType(boolean readFromXml) {
          super();
          this.readFromXml = readFromXml;
@@ -1550,7 +1534,7 @@
          return result;
       }
 
-      private AsyncType(){
+      private AsyncType() {
          this(true);
       }
 
@@ -1583,26 +1567,36 @@
          testImmutability("replQueueClass");
          this.replQueueClass = replQueueClass;
       }
+
+      @Override
+      public void willUnmarshall(Object parent) {
+         ClusteringType clustering = (ClusteringType) parent;
+         if (clustering.sync.unmarshalledFromXml)
+            throw new ConfigurationException("Cannot have both <sync /> and <async /> tags in a <clustering /> tag!");
+         unmarshalledFromXml = true;
+      }
    }
-   
+
    /**
     * This element controls the default expiration settings for entries in the cache.
-    * 
+    *
     * @see <a href="../../../config.html#ce_default_expiration">Configuration reference</a>
     */
    @XmlAccessorType(XmlAccessType.PROPERTY)
    @ConfigurationDoc(name = "expiration")
-   public static class ExpirationType extends AbstractNamedCacheConfigurationBean{
+   public static class ExpirationType extends AbstractNamedCacheConfigurationBean {
 
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = 5757161438110848530L;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setExpirationLifespan")
-      protected Long lifespan=-1L;
-     
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setExpirationMaxIdle")
-      protected Long maxIdle=-1L;
 
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setExpirationLifespan")
+      protected Long lifespan = -1L;
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setExpirationMaxIdle")
+      protected Long maxIdle = -1L;
+
       @XmlAttribute
       public void setLifespan(Long lifespan) {
          testImmutability("lifespan");
@@ -1610,7 +1604,7 @@
       }
 
       public void accept(ConfigurationBeanVisitor v) {
-         v.visitExpirationType(this);         
+         v.visitExpirationType(this);
       }
 
       @XmlAttribute
@@ -1642,28 +1636,30 @@
 
    /**
     * This element controls the eviction settings for the cache.
-    * 
+    *
     * @see <a href="../../../config.html#ce_default_eviction">Configuration reference</a>
     */
    @XmlAccessorType(XmlAccessType.PROPERTY)
    @ConfigurationDoc(name = "eviction")
    public static class EvictionType extends AbstractNamedCacheConfigurationBean {
 
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = -1248563712058858791L;
-     
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setEvictionWakeUpInterval")
-      protected Long wakeUpInterval=5000L;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setEvictionStrategy")
-      protected EvictionStrategy strategy=EvictionStrategy.NONE;
-     
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setEvictionMaxEntries")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setEvictionWakeUpInterval")
+      protected Long wakeUpInterval = 5000L;
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setEvictionStrategy")
+      protected EvictionStrategy strategy = EvictionStrategy.NONE;
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setEvictionMaxEntries")
       protected Integer maxEntries = -1;
-           
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setEvictionThreadPolicy")
-      protected EvictionThreadPolicy threadPolicy=EvictionThreadPolicy.DEFAULT;
 
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setEvictionThreadPolicy")
+      protected EvictionThreadPolicy threadPolicy = EvictionThreadPolicy.DEFAULT;
+
       @XmlAttribute
       public void setWakeUpInterval(Long wakeUpInterval) {
          testImmutability("wakeUpInterval");
@@ -1679,7 +1675,7 @@
          testImmutability("strategy");
          this.strategy = strategy;
       }
-      
+
       @XmlAttribute
       public void setThreadPolicy(EvictionThreadPolicy threadPolicy) {
          testImmutability("threadPolicy");
@@ -1719,42 +1715,44 @@
    }
 
    /**
-    * Configures how state is retrieved when a new cache joins the cluster. This element is only
-    * used with invalidation and replication clustered modes.
-    * 
+    * Configures how state is retrieved when a new cache joins the cluster. This element is only used with invalidation
+    * and replication clustered modes.
+    *
     * @see <a href="../../../config.html#ce_clustering_stateRetrieval">Configuration reference</a>
     */
    @XmlAccessorType(XmlAccessType.PROPERTY)
    @ConfigurationDoc(name = "stateRetrieval")
    public static class StateRetrievalType extends AbstractNamedCacheConfigurationBean {
 
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = 3709234918426217096L;
-     
-      @Dynamic      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setFetchInMemoryState")
+
+      @Dynamic
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setFetchInMemoryState")
       protected Boolean fetchInMemoryState = false;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setAlwaysProvideInMemoryState")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setAlwaysProvideInMemoryState")
       protected Boolean alwaysProvideInMemoryState = false;
-      
-      @Dynamic            
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setStateRetrievalTimeout")
+
+      @Dynamic
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setStateRetrievalTimeout")
       protected Long timeout = 10000L;
-     
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setStateRetrievalInitialRetryWaitTime")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setStateRetrievalInitialRetryWaitTime")
       protected Long initialRetryWaitTime = 500L;
-     
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setStateRetrievalRetryWaitTimeIncreaseFactor")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setStateRetrievalRetryWaitTimeIncreaseFactor")
       protected Integer retryWaitTimeIncreaseFactor = 2;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setStateRetrievalNumRetries")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setStateRetrievalNumRetries")
       protected Integer numRetries = 5;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setStateRetrievalLogFlushTimeout")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setStateRetrievalLogFlushTimeout")
       protected Long logFlushTimeout = 60000L;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setStateRetrievalMaxNonProgressingLogWrites")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setStateRetrievalMaxNonProgressingLogWrites")
       protected Integer maxNonProgressingLogWrites = 100;
 
       @XmlAttribute
@@ -1816,10 +1814,13 @@
 
          StateRetrievalType that = (StateRetrievalType) o;
 
-         if (fetchInMemoryState != null ? !fetchInMemoryState.equals(that.fetchInMemoryState) : that.fetchInMemoryState != null) return false;
+         if (fetchInMemoryState != null ? !fetchInMemoryState.equals(that.fetchInMemoryState) : that.fetchInMemoryState != null)
+            return false;
          if (timeout != null ? !timeout.equals(that.timeout) : that.timeout != null) return false;
-         if (initialRetryWaitTime != null ? !initialRetryWaitTime.equals(that.initialRetryWaitTime) : that.initialRetryWaitTime != null) return false;
-         if (retryWaitTimeIncreaseFactor != null ? !retryWaitTimeIncreaseFactor.equals(that.retryWaitTimeIncreaseFactor) : that.retryWaitTimeIncreaseFactor != null) return false;
+         if (initialRetryWaitTime != null ? !initialRetryWaitTime.equals(that.initialRetryWaitTime) : that.initialRetryWaitTime != null)
+            return false;
+         if (retryWaitTimeIncreaseFactor != null ? !retryWaitTimeIncreaseFactor.equals(that.retryWaitTimeIncreaseFactor) : that.retryWaitTimeIncreaseFactor != null)
+            return false;
          if (numRetries != null ? !numRetries.equals(that.numRetries) : that.numRetries != null) return false;
 
          return true;
@@ -1837,24 +1838,28 @@
    }
 
    /**
-    * If this element is present, all communications are synchronous, in that whenever a thread
-    * sends a message sent over the wire, it blocks until it receives an acknowledgment from the
-    * recipient. This element is mutually exclusive with the <code> &lt;async /&gt;</code> element. <br />
-    * <br />
-    * Characteristics of this can be tuned here.
-    * 
+    * If this element is present, all communications are synchronous, in that whenever a thread sends a message sent
+    * over the wire, it blocks until it receives an acknowledgment from the recipient. This element is mutually
+    * exclusive with the <code> &lt;async /&gt;</code> element. <br /> <br /> Characteristics of this can be tuned
+    * here.
+    *
     * @see <a href="../../../config.html#ce_clustering_sync">Configuration reference</a>
     */
    @XmlAccessorType(XmlAccessType.PROPERTY)
    @ConfigurationDoc(name = "sync")
-   public static class SyncType  extends AbstractNamedCacheConfigurationBean {
-      /** The serialVersionUID */
+   public static class SyncType extends AbstractNamedCacheConfigurationBean {
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = 8419216253674289524L;
-     
-      @Dynamic      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setSyncReplTimeout")
-      protected Long replTimeout=15000L;
 
+      @Dynamic
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setSyncReplTimeout")
+      protected Long replTimeout = 15000L;
+
+      @XmlTransient
+      private boolean unmarshalledFromXml = false;
+
       @XmlAttribute
       public void setReplTimeout(Long replTimeout) {
          testImmutability("replTimeout");
@@ -1882,37 +1887,46 @@
       public int hashCode() {
          return replTimeout != null ? replTimeout.hashCode() : 0;
       }
+
+      @Override
+      public void willUnmarshall(Object parent) {
+         ClusteringType clustering = (ClusteringType) parent;
+         if (clustering.async.unmarshalledFromXml)
+            throw new ConfigurationException("Cannot have both <sync /> and <async /> tags in a <clustering /> tag!");
+         unmarshalledFromXml = true;
+      }
    }
 
    /**
-    * Allows fine-tuning of rehashing characteristics. Only used with 'distributed' cache mode, and
-    * otherwise ignored.
-    * 
+    * Allows fine-tuning of rehashing characteristics. Only used with 'distributed' cache mode, and otherwise ignored.
+    *
     * @see <a href="../../../config.html#ce_clustering_hash">Configuration reference</a>
     */
    @XmlAccessorType(XmlAccessType.PROPERTY)
    @ConfigurationDoc(name = "hash")
    public static class HashType extends AbstractNamedCacheConfigurationBean {
 
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = 752218766840948822L;
-      
-      @ConfigurationDocRef(name="class", bean=Configuration.class,targetElement="setConsistentHashClass")
+
+      @ConfigurationDocRef(name = "class", bean = Configuration.class, targetElement = "setConsistentHashClass")
       protected String consistentHashClass = DefaultConsistentHash.class.getName();
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setNumOwners")
-      protected Integer numOwners=2;
-     
-      @ConfigurationDoc(desc="Future flag. Currenly unused.")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setNumOwners")
+      protected Integer numOwners = 2;
+
+      @ConfigurationDoc(desc = "Future flag. Currenly unused.")
       protected Long rehashWait = MINUTES.toMillis(1);
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setRehashRpcTimeout")
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setRehashRpcTimeout")
       protected Long rehashRpcTimeout = MINUTES.toMillis(10);
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setRehashEnabled")
-      protected Boolean rehashEnabled=true;
 
-      @XmlAttribute(name="class")
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setRehashEnabled")
+      protected Boolean rehashEnabled = true;
+
+      @XmlAttribute(name = "class")
       public void setConsistentHashClass(String consistentHashClass) {
          testImmutability("consistentHashClass");
          this.consistentHashClass = consistentHashClass;
@@ -1976,27 +1990,29 @@
    }
 
    /**
-    * This element configures the L1 cache behavior in 'distributed' caches instances. In any other
-    * cache modes, this element is ignored.
-    * 
+    * This element configures the L1 cache behavior in 'distributed' caches instances. In any other cache modes, this
+    * element is ignored.
+    *
     * @see <a href="../../../config.html#ce_clustering_l1">Configuration reference</a>
     */
    @XmlAccessorType(XmlAccessType.PROPERTY)
    @ConfigurationDoc(name = "l1")
    public static class L1Type extends AbstractNamedCacheConfigurationBean {
 
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = -4703587764861110638L;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setL1CacheEnabled")
-      protected Boolean enabled=true;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setL1Lifespan")
-      protected Long lifespan=600000L;
-      
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setL1OnRehash")
-      protected Boolean onRehash=true;
 
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setL1CacheEnabled")
+      protected Boolean enabled = true;
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setL1Lifespan")
+      protected Long lifespan = 600000L;
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setL1OnRehash")
+      protected Boolean onRehash = true;
+
       @XmlAttribute
       public void setEnabled(Boolean enabled) {
          testImmutability("enabled");
@@ -2043,19 +2059,21 @@
    }
 
    @XmlAccessorType(XmlAccessType.PROPERTY)
-   public static class BooleanAttributeType  extends AbstractNamedCacheConfigurationBean {
+   public static class BooleanAttributeType extends AbstractNamedCacheConfigurationBean {
 
       @XmlTransient
       protected final String fieldName;
 
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = 2296863404153834686L;
 
-      @ConfigurationDoc(desc="Toggle switch")
+      @ConfigurationDoc(desc = "Toggle switch")
       protected Boolean enabled = false;
 
       public BooleanAttributeType() {
-         fieldName= "undefined";
+         fieldName = "undefined";
       }
 
       public BooleanAttributeType(String fieldName) {
@@ -2095,16 +2113,17 @@
    }
 
    /**
-    * A mechanism by which serialization and deserialization of objects is deferred till the point
-    * in time in which they are used and needed. This typically means that any deserialization
-    * happens using the thread context class loader of the invocation that requires deserialization,
-    * and is an effective mechanism to provide classloader isolation.
-    * 
+    * A mechanism by which serialization and deserialization of objects is deferred till the point in time in which they
+    * are used and needed. This typically means that any deserialization happens using the thread context class loader
+    * of the invocation that requires deserialization, and is an effective mechanism to provide classloader isolation.
+    *
     * @see <a href="../../../config.html#ce_default_lazyDeserialization">Configuration reference</a>
     */
    @ConfigurationDoc(name = "lazyDeserialization")
    public static class LazyDeserialization extends BooleanAttributeType {
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = 7404820498857564962L;
 
       public LazyDeserialization() {
@@ -2113,14 +2132,15 @@
    }
 
    /**
-    * 
     * This element specifies whether cache statistics are gathered and reported via JMX.
-    * 
-    * @see <a href="../../../config.html#ce_default_jmxStatistics">Configuration reference</a>           
+    *
+    * @see <a href="../../../config.html#ce_default_jmxStatistics">Configuration reference</a>
     */
-   @ConfigurationDoc(name="jmxStatistics")
+   @ConfigurationDoc(name = "jmxStatistics")
    public static class JmxStatistics extends BooleanAttributeType {
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = 8716456707015486673L;
 
       public JmxStatistics() {
@@ -2129,14 +2149,16 @@
    }
 
    /**
-    * Defines whether invocation batching is allowed in this cache instance, and sets up internals accordingly to allow use of this API.
-    * 
+    * Defines whether invocation batching is allowed in this cache instance, and sets up internals accordingly to allow
+    * use of this API.
+    *
     * @see <a href="../../../config.html#ce_default_invocationBatching">Configuration reference</a>
-    * 
     */
    @ConfigurationDoc(name = "invocationBatching")
    public static class InvocationBatching extends BooleanAttributeType {
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = 5854115656815587815L;
 
       public InvocationBatching() {
@@ -2146,23 +2168,24 @@
 
    /**
     * This element configures deadlock detection.
-    * 
-    * 
+    *
     * @see <a href="../../../config.html#ce_default_deadlockDetection">Configuration reference</a>
     */
    @XmlAccessorType(XmlAccessType.PROPERTY)
-   @ConfigurationDoc(name="deadlockDetection")
-   public static class DeadlockDetectionType  extends AbstractNamedCacheConfigurationBean{
+   @ConfigurationDoc(name = "deadlockDetection")
+   public static class DeadlockDetectionType extends AbstractNamedCacheConfigurationBean {
 
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = -7178286048602531152L;
-     
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setEnableDeadlockDetection")
-      protected Boolean enabled=false;
-     
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setDeadlockDetectionSpinDuration")
-      protected Long spinDuration=100L;
 
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setEnableDeadlockDetection")
+      protected Boolean enabled = false;
+
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setDeadlockDetectionSpinDuration")
+      protected Long spinDuration = 100L;
+
       @XmlAttribute
       public void setEnabled(Boolean enabled) {
          testImmutability("enabled");
@@ -2201,22 +2224,24 @@
    }
 
    /**
-    * Allows you to tune various unsafe or non-standard characteristics. Certain operations 
-    * such as Cache.put() that are supposed to return the previous value associated with the specified key according 
-    * to the java.util.Map contract will not fulfill this contract if unsafe toggle is turned on. Use with care.  
-    * See details at http://www.jboss.org/community/wiki/infinispantechnicalfaqs
-    * 
+    * Allows you to tune various unsafe or non-standard characteristics. Certain operations such as Cache.put() that are
+    * supposed to return the previous value associated with the specified key according to the java.util.Map contract
+    * will not fulfill this contract if unsafe toggle is turned on. Use with care. See details at
+    * http://www.jboss.org/community/wiki/infinispantechnicalfaqs
+    *
     * @see <a href="../../../config.html#ce_default_unsafe">Configuration reference</a>
     */
    @XmlAccessorType(XmlAccessType.PROPERTY)
-   @ConfigurationDoc(name="unsafe")
-   public static class UnsafeType  extends AbstractNamedCacheConfigurationBean{
+   @ConfigurationDoc(name = "unsafe")
+   public static class UnsafeType extends AbstractNamedCacheConfigurationBean {
 
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = -9200921443651234163L;
 
-      @ConfigurationDocRef(bean=Configuration.class,targetElement="setUnsafeUnreliableReturnValues")
-      protected Boolean unreliableReturnValues=false;
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setUnsafeUnreliableReturnValues")
+      protected Boolean unreliableReturnValues = false;
 
       @XmlAttribute
       public void setUnreliableReturnValues(Boolean unreliableReturnValues) {
@@ -2249,25 +2274,27 @@
 
    /**
     * Configures custom interceptors to be added to the cache.
-    * 
+    *
     * @see <a href="../../../config.html#ce_default_customInterceptors">Configuration reference</a>
     */
    @XmlAccessorType(XmlAccessType.FIELD)
-   @ConfigurationDoc(name="customInterceptors")
+   @ConfigurationDoc(name = "customInterceptors")
    public static class CustomInterceptorsType extends AbstractNamedCacheConfigurationBean {
 
-      /** The serialVersionUID */
+      /**
+       * The serialVersionUID
+       */
       private static final long serialVersionUID = 7187545782011884661L;
 
-      @XmlElement(name="interceptor")
-      private List<CustomInterceptorConfig> customInterceptors= new ArrayList<CustomInterceptorConfig>();
+      @XmlElement(name = "interceptor")
+      private List<CustomInterceptorConfig> customInterceptors = new ArrayList<CustomInterceptorConfig>();
 
       @Override
       public CustomInterceptorsType clone() throws CloneNotSupportedException {
          CustomInterceptorsType dolly = (CustomInterceptorsType) super.clone();
          if (customInterceptors != null) {
             dolly.customInterceptors = new ArrayList<CustomInterceptorConfig>();
-            for (CustomInterceptorConfig config: customInterceptors) {
+            for (CustomInterceptorConfig config : customInterceptors) {
                CustomInterceptorConfig clone = config.clone();
                dolly.customInterceptors.add(clone);
             }
@@ -2282,7 +2309,7 @@
          v.visitCustomInterceptorsType(this);
       }
 
-      public List<CustomInterceptorConfig> getCustomInterceptors(){
+      public List<CustomInterceptorConfig> getCustomInterceptors() {
          return customInterceptors;
       }
 
@@ -2309,81 +2336,83 @@
          this.customInterceptors = customInterceptors;
       }
    }
-   
+
    /**
-    * Configures indexing of entries in the cache for searching.  
-    * Note that infinispan-query.jar and its dependencies needs to be available if this option is to be used.
-    * 
+    * Configures indexing of entries in the cache for searching. Note that infinispan-query.jar and its dependencies
+    * needs to be available if this option is to be used.
+    *
     * @see <a href="../../../config.html#ce_default_indexing">Configuration reference</a>
     */
    @XmlAccessorType(XmlAccessType.PROPERTY)
-   @ConfigurationDoc(name="indexing")
+   @ConfigurationDoc(name = "indexing")
    public static class QueryConfigurationBean extends AbstractConfigurationBean {
 
-       /** The serialVersionUID */
-       private static final long serialVersionUID = 2891683014353342549L;
+      /**
+       * The serialVersionUID
+       */
+      private static final long serialVersionUID = 2891683014353342549L;
 
-       @ConfigurationDocRef(bean=Configuration.class,targetElement="setIndexingEnabled")
-       protected Boolean enabled = false;
-       
-       @ConfigurationDocRef(bean=Configuration.class,targetElement="setIndexLocalOnly")
-       protected Boolean indexLocalOnly = false;
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setIndexingEnabled")
+      protected Boolean enabled = false;
 
-       public Boolean isEnabled() {
-           return enabled;
-       }
+      @ConfigurationDocRef(bean = Configuration.class, targetElement = "setIndexLocalOnly")
+      protected Boolean indexLocalOnly = false;
 
-       @XmlAttribute
-       public void setEnabled(Boolean enabled) {
-           testImmutability("enabled");
-           this.enabled = enabled;
-       }
+      public Boolean isEnabled() {
+         return enabled;
+      }
 
-       public Boolean isIndexLocalOnly() {
-           return indexLocalOnly;
-       }
+      @XmlAttribute
+      public void setEnabled(Boolean enabled) {
+         testImmutability("enabled");
+         this.enabled = enabled;
+      }
 
-       @XmlAttribute
-       public void setIndexLocalOnly(Boolean indexLocalOnly) {
-           testImmutability("indexLocalOnly");
-           this.indexLocalOnly = indexLocalOnly;
-       }
-       
-       public void accept(ConfigurationBeanVisitor v) {
-          v.visitQueryConfigurationBean(this);
-       }
+      public Boolean isIndexLocalOnly() {
+         return indexLocalOnly;
+      }
 
-       @Override
-       public boolean equals(Object o) {
-           if (this == o)
-               return true;
-           if (!(o instanceof QueryConfigurationBean))
-               return false;
+      @XmlAttribute
+      public void setIndexLocalOnly(Boolean indexLocalOnly) {
+         testImmutability("indexLocalOnly");
+         this.indexLocalOnly = indexLocalOnly;
+      }
 
-           QueryConfigurationBean that = (QueryConfigurationBean) o;
+      public void accept(ConfigurationBeanVisitor v) {
+         v.visitQueryConfigurationBean(this);
+      }
 
-           if (enabled != null ? !enabled.equals(that.enabled) : that.enabled != null)
-               return false;
+      @Override
+      public boolean equals(Object o) {
+         if (this == o)
+            return true;
+         if (!(o instanceof QueryConfigurationBean))
+            return false;
 
-           if (indexLocalOnly != null ? !indexLocalOnly.equals(that.indexLocalOnly): that.indexLocalOnly != null)
-               return false;
+         QueryConfigurationBean that = (QueryConfigurationBean) o;
 
-           return true;
-       }
+         if (enabled != null ? !enabled.equals(that.enabled) : that.enabled != null)
+            return false;
 
-       @Override
-       public int hashCode() {
-           int result = enabled != null ? enabled.hashCode() : 0;
-           result = 31 * result + (indexLocalOnly != null ? indexLocalOnly.hashCode() : 0);
-           return result;
-       }
+         if (indexLocalOnly != null ? !indexLocalOnly.equals(that.indexLocalOnly) : that.indexLocalOnly != null)
+            return false;
 
-       @Override
-       protected boolean hasComponentStarted() {
-           return false;
-       }
+         return true;
+      }
 
       @Override
+      public int hashCode() {
+         int result = enabled != null ? enabled.hashCode() : 0;
+         result = 31 * result + (indexLocalOnly != null ? indexLocalOnly.hashCode() : 0);
+         return result;
+      }
+
+      @Override
+      protected boolean hasComponentStarted() {
+         return false;
+      }
+
+      @Override
       public QueryConfigurationBean clone() {
          try {
             QueryConfigurationBean dolly = (QueryConfigurationBean) super.clone();

Modified: branches/4.2.x/core/src/main/java/org/infinispan/config/ConfigurationValidatingVisitor.java
===================================================================
--- branches/4.2.x/core/src/main/java/org/infinispan/config/ConfigurationValidatingVisitor.java	2010-10-22 12:55:01 UTC (rev 2575)
+++ branches/4.2.x/core/src/main/java/org/infinispan/config/ConfigurationValidatingVisitor.java	2010-10-22 14:19:17 UTC (rev 2576)
@@ -49,4 +49,13 @@
    @Override
    public void visitConfiguration(Configuration bean) {
    }
+
+   @Override
+   public void visitClusteringType(Configuration.ClusteringType clusteringType) {
+      if (clusteringType.mode.isDistributed() && clusteringType.async.useReplQueue)
+         throw new ConfigurationException("Use of the replication queue is invalid when using DISTRIBUTED mode.");
+
+      if (clusteringType.mode.isSynchronous() && clusteringType.async.useReplQueue)
+         throw new ConfigurationException("Use of the replication queue is only allowed with an ASYNCHRONOUS cluster mode.");
+   }
 }

Modified: branches/4.2.x/core/src/main/java/org/infinispan/config/InfinispanConfiguration.java
===================================================================
--- branches/4.2.x/core/src/main/java/org/infinispan/config/InfinispanConfiguration.java	2010-10-22 12:55:01 UTC (rev 2575)
+++ branches/4.2.x/core/src/main/java/org/infinispan/config/InfinispanConfiguration.java	2010-10-22 14:19:17 UTC (rev 2576)
@@ -248,7 +248,7 @@
             public void beforeUnmarshal(Object target, Object parent) {
                if (target instanceof JAXBUnmarshallable) {
                   // notify the bean that it is about to be unmarshalled
-                  ((JAXBUnmarshallable) target).willUnmarshall();
+                  ((JAXBUnmarshallable) target).willUnmarshall(parent);
                }
             }
          });
@@ -414,7 +414,7 @@
    }
 
    @Override
-   public void willUnmarshall() {
+   public void willUnmarshall(Object parent) {
       // no-op
    }
 }

Modified: branches/4.2.x/core/src/main/java/org/infinispan/config/JAXBUnmarshallable.java
===================================================================
--- branches/4.2.x/core/src/main/java/org/infinispan/config/JAXBUnmarshallable.java	2010-10-22 12:55:01 UTC (rev 2575)
+++ branches/4.2.x/core/src/main/java/org/infinispan/config/JAXBUnmarshallable.java	2010-10-22 14:19:17 UTC (rev 2576)
@@ -9,6 +9,7 @@
 public interface JAXBUnmarshallable {
    /**
     * Indicates that this element is about to be unmarshalled from the XML source that was processed.
+    * @param parent parent component
     */
-   public void willUnmarshall();
+   public void willUnmarshall(Object parent);
 }

Modified: branches/4.2.x/core/src/main/resources/config-samples/all.xml
===================================================================
--- branches/4.2.x/core/src/main/resources/config-samples/all.xml	2010-10-22 12:55:01 UTC (rev 2575)
+++ branches/4.2.x/core/src/main/resources/config-samples/all.xml	2010-10-22 14:19:17 UTC (rev 2576)
@@ -190,7 +190,7 @@
    </namedCache>
 
    <namedCache name="withReplicationQueue">
-      <clustering>
+      <clustering mode="r">
          <async useReplQueue="true" replQueueInterval="100" replQueueMaxElements="200"/>
       </clustering>
    </namedCache>

Modified: branches/4.2.x/core/src/test/java/org/infinispan/config/ConfigurationValidationTest.java
===================================================================
--- branches/4.2.x/core/src/test/java/org/infinispan/config/ConfigurationValidationTest.java	2010-10-22 12:55:01 UTC (rev 2575)
+++ branches/4.2.x/core/src/test/java/org/infinispan/config/ConfigurationValidationTest.java	2010-10-22 14:19:17 UTC (rev 2576)
@@ -23,13 +23,11 @@
 
 import org.infinispan.manager.EmbeddedCacheManager;
 import org.infinispan.test.AbstractInfinispanTest;
-import org.infinispan.test.SingleCacheManagerTest;
 import org.infinispan.test.TestingUtil;
 import org.infinispan.test.fwk.TestCacheManagerFactory;
 import org.testng.annotations.Test;
 
-import static org.infinispan.config.Configuration.CacheMode.LOCAL;
-import static org.infinispan.config.Configuration.CacheMode.REPL_ASYNC;
+import static org.infinispan.config.Configuration.CacheMode.*;
 
 /**
  * ConfigurationValidationTest.
@@ -61,7 +59,34 @@
       }
    }
 
+   @Test (expectedExceptions = ConfigurationException.class)
+   public void testDistAndReplQueue() {
+      EmbeddedCacheManager ecm = null;
+      try {
+         Configuration c = new Configuration();
+         c.setCacheMode(DIST_SYNC);
+         c.setUseReplQueue(true);
+         ecm = TestCacheManagerFactory.createClusteredCacheManager(c);
+         ecm.getCache();
+      } finally {
+         TestingUtil.killCacheManagers(ecm);
+      }
+   }
 
+   @Test (expectedExceptions = ConfigurationException.class)
+   public void testSyncAndReplQueue() {
+      EmbeddedCacheManager ecm = null;
+      try {
+         Configuration c = new Configuration();
+         c.setCacheMode(REPL_SYNC);
+         c.setUseReplQueue(true);
+         ecm = TestCacheManagerFactory.createClusteredCacheManager(c);
+         ecm.getCache();
+      } finally {
+         TestingUtil.killCacheManagers(ecm);
+      }
+   }
+
    private EmbeddedCacheManager createCacheManager() throws Exception {
       GlobalConfiguration gc = GlobalConfiguration.getNonClusteredDefault();
       Configuration config = new Configuration();

Added: branches/4.2.x/core/src/test/java/org/infinispan/config/SyncAsyncParsingTest.java
===================================================================
--- branches/4.2.x/core/src/test/java/org/infinispan/config/SyncAsyncParsingTest.java	                        (rev 0)
+++ branches/4.2.x/core/src/test/java/org/infinispan/config/SyncAsyncParsingTest.java	2010-10-22 14:19:17 UTC (rev 2576)
@@ -0,0 +1,28 @@
+package org.infinispan.config;
+
+import org.infinispan.manager.CacheContainer;
+import org.infinispan.test.fwk.TestCacheManagerFactory;
+import org.testng.annotations.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+ at Test(testName = "config.SyncAsyncParsingTest", groups = "functional")
+public class SyncAsyncParsingTest {
+
+   @Test (expectedExceptions = ConfigurationException.class)
+   public void testSyncAndAsyncElements() throws IOException {
+      String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+              "<infinispan\n" +
+              "      xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
+              "      xsi:schemaLocation=\"urn:infinispan:config:4.0 http://www.infinispan.org/schemas/infinispan-config-4.0.xsd\"\n" +
+              "      xmlns=\"urn:infinispan:config:4.0\">" +
+              "<global><transport /></global>" + 
+              "<default><clustering><sync /><async /></clustering></default></infinispan>";
+
+      InputStream stream = new ByteArrayInputStream(xml.getBytes());
+      CacheContainer cc = TestCacheManagerFactory.fromStream(stream);
+      cc.getCache();
+   }
+}

Modified: branches/4.2.x/core/src/test/java/org/infinispan/test/TestingUtil.java
===================================================================
--- branches/4.2.x/core/src/test/java/org/infinispan/test/TestingUtil.java	2010-10-22 12:55:01 UTC (rev 2575)
+++ branches/4.2.x/core/src/test/java/org/infinispan/test/TestingUtil.java	2010-10-22 14:19:17 UTC (rev 2576)
@@ -433,7 +433,7 @@
                try {
                   clearContent(cm);
                } finally {
-                  cm.stop();
+                  if (cm != null) cm.stop();
                }
             } catch (Throwable e) {
                log.warn("Problems killing cache manager " + cm, e);

Modified: branches/4.2.x/core/src/test/resources/configs/named-cache-test.xml
===================================================================
--- branches/4.2.x/core/src/test/resources/configs/named-cache-test.xml	2010-10-22 12:55:01 UTC (rev 2575)
+++ branches/4.2.x/core/src/test/resources/configs/named-cache-test.xml	2010-10-22 14:19:17 UTC (rev 2576)
@@ -139,7 +139,7 @@
    </namedCache>
 
    <namedCache name="withouthJmxEnabled">
-      <clustering>
+      <clustering mode="r" >
          <async useReplQueue="true" replQueueInterval="100" replQueueMaxElements="200"/>
       </clustering>
       <jmxStatistics enabled="false"/>
@@ -172,7 +172,7 @@
    </namedCache>
 
    <namedCache name="withReplicationQueue">
-      <clustering>
+      <clustering mode="r">
          <async useReplQueue="true" replQueueInterval="100" replQueueMaxElements="200"/>
       </clustering>
    </namedCache>



More information about the infinispan-commits mailing list