示例#1
0
  private void sendBatchXA() {
    try {
      sendMessages();

      // Commit the JTA transaction and start another

      delistResources(tx);

      if (JMSBridgeImpl.trace) {
        HornetQJMSServerLogger.LOGGER.trace("Committing JTA transaction");
      }

      tx.commit();

      if (JMSBridgeImpl.trace) {
        HornetQJMSServerLogger.LOGGER.trace("Committed JTA transaction");
      }

      tx = startTx();

      enlistResources(tx);

      // Clear the messages
      messages.clear();
    } catch (Exception e) {
      HornetQJMSServerLogger.LOGGER.bridgeAckError(e);

      handleFailureOnSend();
    }
  }
示例#2
0
  private void cleanup() {
    // Stop the source connection
    try {
      sourceConn.stop();
    } catch (Throwable ignore) {
      if (JMSBridgeImpl.trace) {
        HornetQJMSServerLogger.LOGGER.trace("Failed to stop source connection", ignore);
      }
    }

    if (tx != null) {
      try {
        delistResources(tx);
      } catch (Throwable ignore) {
        if (JMSBridgeImpl.trace) {
          HornetQJMSServerLogger.LOGGER.trace("Failed to delist resources", ignore);
        }
      }
      try {
        // Terminate the tx
        tx.rollback();
      } catch (Throwable ignore) {
        if (JMSBridgeImpl.trace) {
          HornetQJMSServerLogger.LOGGER.trace("Failed to rollback", ignore);
        }
      }
    }

    // Close the old objects
    try {
      sourceConn.close();
    } catch (Throwable ignore) {
      if (JMSBridgeImpl.trace) {
        HornetQJMSServerLogger.LOGGER.trace("Failed to close source connection", ignore);
      }
    }
    try {
      if (targetConn != null) {
        targetConn.close();
      }
    } catch (Throwable ignore) {
      if (JMSBridgeImpl.trace) {
        HornetQJMSServerLogger.LOGGER.trace("Failed to close target connection", ignore);
      }
    }
  }