Created
May 14, 2012 08:30
-
-
Save milenkovicm/2692708 to your computer and use it in GitHub Desktop.
TransactionManager locateTM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** The Resource adapter can't depend on any provider's specific library. Because of that we use reflection to locate the | |
* transaction manager during startup. | |
* | |
* | |
* TODO: https://jira.jboss.org/browse/HORNETQ-417 | |
* We should use a proper SPI instead of reflection | |
* We would need to define a proper SPI package for this. | |
* */ | |
public static TransactionManager locateTM(final String locatorClass, final String locatorMethod) | |
{ | |
try | |
{ | |
ClassLoader loader = Thread.currentThread().getContextClassLoader(); | |
Class<?> aClass = loader.loadClass(locatorClass); | |
Object o = aClass.newInstance(); | |
Method m = aClass.getMethod(locatorMethod); | |
return (TransactionManager)m.invoke(o); | |
} | |
catch (Throwable e) | |
{ | |
HornetQRALogger.LOGGER.debug(e.getMessage(), e); | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment