rm.getResourceName() != null && !"".equals(rm.getResourceName());
}
public static boolean recover(final GenericResourceManager rm) throws IOException {
if (isRecoverable(rm)) {
final XAConnectionFactory connFactory = (XAConnectionFactory) rm.getConnectionFactory();
RecoverableTransactionManager rtxManager = (RecoverableTransactionManager) rm.getTransactionManager();
rtxManager.registerNamedXAResourceFactory(new NamedXAResourceFactory() {
public String getName() {
return rm.getResourceName();
}
public NamedXAResource getNamedXAResource() throws SystemException {
try {
final XAConnection activeConn = (XAConnection)connFactory.createXAConnection();
final XASession session = (XASession)activeConn.createXASession();
activeConn.start();
LOGGER.debug("new namedXAResource's connection: " + activeConn);
return new ConnectionAndWrapperNamedXAResource(session.getXAResource(), getName(), activeConn);