All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.client.hotrod.transaction.lookup.GenericTransactionManagerLookup Maven / Gradle / Ivy

There is a newer version: 15.1.0.Dev04
Show newest version
package org.infinispan.client.hotrod.transaction.lookup;

import org.infinispan.client.hotrod.transaction.manager.RemoteTransactionManager;
import org.infinispan.commons.tx.lookup.LookupNames;
import org.infinispan.commons.tx.lookup.TransactionManagerLookup;

import jakarta.transaction.TransactionManager;
import net.jcip.annotations.GuardedBy;

/**
 * A {@link TransactionManagerLookup} implementation that attempts to locate a {@link TransactionManager}.
 * 

* A variety of different classes and JNDI locations are tried, for servers such as:

  • JBoss
  • JRun4
  • * Resin
  • Orion
  • JOnAS
  • BEA Weblogic
  • Websphere 4.0, 5.0, 5.1, 6.0
  • Sun, Glassfish
. *

* If a transaction manager is not found, returns an {@link RemoteTransactionManager}. * * @author Pedro Ruivo * @since 9.3 */ public class GenericTransactionManagerLookup implements TransactionManagerLookup { private static final GenericTransactionManagerLookup INSTANCE = new GenericTransactionManagerLookup(); @GuardedBy("this") private TransactionManager transactionManager = null; private GenericTransactionManagerLookup() { } public static GenericTransactionManagerLookup getInstance() { return INSTANCE; } @Override public synchronized TransactionManager getTransactionManager() { if (transactionManager != null) { return transactionManager; } transactionManager = LookupNames.lookupKnownTransactionManagers(GenericTransactionManagerLookup.class.getClassLoader()) .orElseGet(RemoteTransactionManager::getInstance); return transactionManager; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy