@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;
TransactionManagerLookup lookup = configuration.getTransactionManagerLookup();
if (lookup == null) {
// Nope. See if we can look it up from JNDI
if (configuration.getTransactionManagerLookupClass() != null) {
try {
lookup = (TransactionManagerLookup) Util.getInstance(configuration.getTransactionManagerLookupClass());
}
catch (Exception e) {
throw new ConfigurationException("Problems looking up transaction manager", e);
}
}
}
try {
if (lookup != null) {
transactionManager = lookup.getTransactionManager();
}
}
catch (Exception e) {
log.info("failed looking up TransactionManager, will not use transactions", e);
}