private void tryRollback(Channel channel) {
   try {
     channel.txRollback();
   } catch (IOException e) {
     logger.debug("Unable to rollback. The underlying channel might already be closed.", e);
   }
 }
 @Override
 public void onRollback(Throwable failureCause) {
   try {
     channel.txRollback();
   } catch (IOException e) {
     logger.warn("Unable to rollback transaction on channel.", e);
   }
   tryClose(channel);
   isOpen = false;
 }
Esempio n. 3
0
  @Override
  protected <E> boolean transactionalPublishImpl(
      Collection<E> messageBundles, TransportPublishProperties properties)
      throws IOException, TimeoutException, InterruptedException {
    channel.txSelect();

    boolean rollback = true;

    try {
      for (E messageBundle : messageBundles) {
        if (!publishImpl((AMQPMessageBundle) messageBundle, properties)) return false;
      }
      rollback = false;
    } finally {
      // ! Explicitly roll back.
      if (rollback) channel.txRollback();
      else channel.txCommit();
    }

    return !rollback;
  }