/** This will be called periodically by the Transaction Manager */ public XAResource[] getXAResources() { try { checkFailures(); HornetQXAResourceWrapper[] resourceArray = new HornetQXAResourceWrapper[recoveries.size()]; resourceArray = recoveries.values().toArray(resourceArray); if (HornetQJMSServerLogger.LOGGER.isDebugEnabled()) { HornetQJMSServerLogger.LOGGER.debug( "\n======================================================================================="); HornetQJMSServerLogger.LOGGER.debug("Returning the following list on getXAREsources:"); for (Map.Entry<String, HornetQXAResourceWrapper> entry : recoveries.entrySet()) { HornetQJMSServerLogger.LOGGER.debug( "server-id=" + entry.getKey() + ", value=" + entry.getValue()); } HornetQJMSServerLogger.LOGGER.debug( "=======================================================================================\n"); } return resourceArray; } catch (Throwable e) { HornetQJMSServerLogger.LOGGER.warn(e.getMessage(), e); return new XAResource[] {}; } }
/** * @param nodeID * @param networkConfiguration * @param username * @param password */ public void nodeUp( String nodeID, Pair<TransportConfiguration, TransportConfiguration> networkConfiguration, String username, String password) { if (recoveries.get(nodeID) == null) { if (HornetQJMSServerLogger.LOGGER.isDebugEnabled()) { HornetQJMSServerLogger.LOGGER.debug( nodeID + " being registered towards " + networkConfiguration); } XARecoveryConfig config = new XARecoveryConfig( true, extractTransportConfiguration(networkConfiguration), username, password); HornetQXAResourceWrapper wrapper = new HornetQXAResourceWrapper(config); recoveries.putIfAbsent(nodeID, wrapper); } }