[infinispan-commits] Infinispan SVN: r703 - in trunk/core/src/main/java/org/infinispan: factories and 1 other directory.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Mon Aug 17 12:26:39 EDT 2009
Author: galder.zamarreno at jboss.com
Date: 2009-08-17 12:26:39 -0400 (Mon, 17 Aug 2009)
New Revision: 703
Modified:
trunk/core/src/main/java/org/infinispan/config/Configuration.java
trunk/core/src/main/java/org/infinispan/factories/TransactionManagerFactory.java
Log:
[ISPN-160] (Add set/get ops for TransactionManagerLookup) Added methods and modified the factory accordingly.
Modified: trunk/core/src/main/java/org/infinispan/config/Configuration.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/Configuration.java 2009-08-17 13:54:35 UTC (rev 702)
+++ trunk/core/src/main/java/org/infinispan/config/Configuration.java 2009-08-17 16:26:39 UTC (rev 703)
@@ -27,6 +27,7 @@
import org.infinispan.factories.annotations.NonVolatile;
import org.infinispan.factories.annotations.Start;
import org.infinispan.transaction.lookup.GenericTransactionManagerLookup;
+import org.infinispan.transaction.lookup.TransactionManagerLookup;
import org.infinispan.util.concurrent.IsolationLevel;
import org.infinispan.CacheException;
@@ -55,7 +56,8 @@
*
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @author Vladimir Blagojevic
+ * @author Vladimir Blagojevic
+ * @author Galder Zamarreño
* @since 4.0
*/
@NonVolatile
@@ -65,8 +67,8 @@
@ConfigurationElement(name = "locking", parent = "default", description = ""),
@ConfigurationElement(name = "transaction", parent = "default", description = ""),
@ConfigurationElement(name = "jmxStatistics", parent = "default", description = ""),
- @ConfigurationElement(name = "lazyDeserialization", parent = "default", description = ""),
- @ConfigurationElement(name = "invocationBatching", parent = "default", description = ""),
+ @ConfigurationElement(name = "lazyDeserialization", parent = "default", description = ""),
+ @ConfigurationElement(name = "invocationBatching", parent = "default", description = ""),
@ConfigurationElement(name = "clustering", parent = "default", description = ""),
@ConfigurationElement(name = "stateRetrieval", parent = "clustering"),
@ConfigurationElement(name = "sync", parent = "clustering"),
@@ -77,7 +79,7 @@
@ConfigurationElement(name = "expiration", parent = "default", description = ""),
@ConfigurationElement(name = "unsafe", parent = "default", description = ""),
@ConfigurationElement(name = "deadlockDetection", parent = "default", description = ""),
- @ConfigurationElement(name = "customInterceptors", parent = "default")
+ @ConfigurationElement(name = "customInterceptors", parent = "default")
})
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder={})
@@ -393,6 +395,10 @@
public void setTransactionManagerLookupClass(String transactionManagerLookupClass) {
this.transaction.setTransactionManagerLookupClass(transactionManagerLookupClass);
}
+
+ public void setTransactionManagerLookup(TransactionManagerLookup transactionManagerLookup) {
+ this.transaction.transactionManagerLookup = transactionManagerLookup;
+ }
public void setCacheLoaderManagerConfig(CacheLoaderManagerConfig cacheLoaderManagerConfig) {
this.loaders = cacheLoaderManagerConfig;
@@ -553,6 +559,10 @@
return transaction.transactionManagerLookupClass;
}
+ public TransactionManagerLookup getTransactionManagerLookup() {
+ return transaction.transactionManagerLookup;
+ }
+
public CacheLoaderManagerConfig getCacheLoaderManagerConfig() {
return loaders;
}
@@ -764,6 +774,9 @@
private String transactionManagerLookupClass;
+ @XmlTransient
+ private TransactionManagerLookup transactionManagerLookup;
+
@Dynamic
private Boolean syncCommitPhase = false;
Modified: trunk/core/src/main/java/org/infinispan/factories/TransactionManagerFactory.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/factories/TransactionManagerFactory.java 2009-08-17 13:54:35 UTC (rev 702)
+++ trunk/core/src/main/java/org/infinispan/factories/TransactionManagerFactory.java 2009-08-17 16:26:39 UTC (rev 703)
@@ -33,16 +33,17 @@
* Uses a number of mechanisms to retrieve a transaction manager.
*
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @author Galder Zamarreño
* @since 4.0
*/
@DefaultFactoryFor(classes = {TransactionManager.class})
public class TransactionManagerFactory extends AbstractNamedCacheComponentFactory implements AutoInstantiableFactory {
public <T> T construct(Class<T> componentType) {
// See if we had a TransactionManager injected into our config
- TransactionManager transactionManager = null; //configuration.getRuntimeConfig().getTransactionManager();
- TransactionManagerLookup lookup = null;
+ TransactionManager transactionManager = null;
+ TransactionManagerLookup lookup = configuration.getTransactionManagerLookup();
- if (transactionManager == null) {
+ if (lookup == null) {
// Nope. See if we can look it up from JNDI
if (configuration.getTransactionManagerLookupClass() != null) {
try {
@@ -52,17 +53,16 @@
throw new ConfigurationException("Problems looking up transaction manager", e);
}
}
-
- try {
- if (lookup != null) {
- transactionManager = lookup.getTransactionManager();
-// configuration.getRuntimeConfig().setTransactionManager(transactionManager);
- }
+ }
+
+ try {
+ if (lookup != null) {
+ transactionManager = lookup.getTransactionManager();
}
- catch (Exception e) {
- log.info("failed looking up TransactionManager, will not use transactions", e);
- }
}
+ catch (Exception e) {
+ log.info("failed looking up TransactionManager, will not use transactions", e);
+ }
if (transactionManager == null && configuration.isInvocationBatchingEnabled()) {
log.info("Using a batchMode transaction manager");
More information about the infinispan-commits
mailing list