org.apache.flume.Transaction.rollback()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.apache.flume.Transaction.rollback()方法的一些代码示例,展示了Transaction.rollback()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transaction.rollback()方法的具体详情如下:
包路径:org.apache.flume.Transaction
类名称:Transaction
方法名:rollback

Transaction.rollback介绍

[英]Indicates that the transaction can must be aborted. It is required that a transaction be in progress when this method is invoked.
[中]指示必须中止事务。调用此方法时,要求事务正在进行。

代码示例

代码示例来源:origin: apache/flume

/**
 * Rollback the transaction. If there is a RuntimeException during rollback,
 * it will be logged but the transaction instance variable will still be
 * nullified.
 */
private void rollbackTransaction() {
 if (transaction != null) {
  try {
   // If the transaction wasn't committed before we got the exception, we
   // need to rollback.
   transaction.rollback();
  } catch (RuntimeException ex) {
   LOG.error("Transaction rollback failed: " + ex.getLocalizedMessage());
   LOG.debug("Exception follows.", ex);
  } finally {
   transaction.close();
   this.transaction = null;
  }
 }
}

代码示例来源:origin: apache/flume

private void handleTransactionFailure(Transaction txn)
  throws EventDeliveryException {
 if (maxConsecutiveFails > 0 && consecutiveHBaseFailures >= maxConsecutiveFails) {
  if (client != null) {
   shutdownHBaseClient();
  }
  consecutiveHBaseFailures = 0;
 }
 try {
  txn.rollback();
 } catch (Throwable e) {
  logger.error("Failed to commit transaction." +
    "Transaction rolled back.", e);
  if (e instanceof Error || e instanceof RuntimeException) {
   logger.error("Failed to commit transaction." +
     "Transaction rolled back.", e);
   Throwables.propagate(e);
  } else {
   logger.error("Failed to commit transaction." +
     "Transaction rolled back.", e);
   throw new EventDeliveryException("Failed to commit transaction." +
     "Transaction rolled back.", e);
  }
 } finally {
  txn.close();
 }
}

代码示例来源:origin: apache/rocketmq-externals

sinkCounter.incrementBatchEmptyCount();
  transaction.rollback();
  return Status.BACKOFF;
  transaction.rollback();
  return Status.BACKOFF;
} else {
    transaction.rollback();
  } catch (Exception ex) {
    log.error("Failed to rollback transaction", ex);

代码示例来源:origin: apache/flume

interrupted = Thread.currentThread().isInterrupted();
try {
 transaction.rollback();
} catch (Throwable e2) {
 logger.error("Failed to roll back transaction, exception follows:", e2);

代码示例来源:origin: apache/flume

txn.rollback();
   } else {
    txn.commit();
   txn.rollback();
   status = Status.BACKOFF;
  txn.rollback();
  status = Status.BACKOFF;
txn.rollback();
status = Status.BACKOFF;

代码示例来源:origin: apache/flume

tx.rollback();
if (t instanceof Error) {
 LOG.error("Error while writing to required channel: " + reqChannel, t);
tx.rollback();
LOG.error("Unable to put batch on optional channel: " + optChannel, t);
if (t instanceof Error) {

代码示例来源:origin: kaaproject/kaa

transaction.rollback();
 LOG.warn("HDFS IO error", ex);
 return Status.BACKOFF;
} catch (Throwable th) { //NOSONAR
 transaction.rollback();
 LOG.error("process failed", th);
 if (th instanceof Error) {

代码示例来源:origin: apache/ignite

transaction.rollback();

代码示例来源:origin: apache/flume

transaction.rollback();
 logger.error(
   "Unable to get event from channel. Exception follows.", e);
 status = Status.BACKOFF;
} catch (Exception e) {
 transaction.rollback();
 logger.error(
   "Unable to communicate with IRC server. Exception follows.",

代码示例来源:origin: apache/flume

@Override
 public Status process() throws EventDeliveryException {
  Status result = Status.READY;
  Channel channel = getChannel();
  Transaction transaction = channel.getTransaction();
  Event event = null;

  try {
   transaction.begin();
   event = channel.take();

   if (event != null) {
    if (logger.isInfoEnabled()) {
     logger.info("Event: " + EventHelper.dumpEvent(event, maxBytesToLog));
    }
   } else {
    // No event found, request back-off semantics from the sink runner
    result = Status.BACKOFF;
   }
   transaction.commit();
  } catch (Exception ex) {
   transaction.rollback();
   throw new EventDeliveryException("Failed to log event: " + event, ex);
  } finally {
   transaction.close();
  }

  return result;
 }
}

代码示例来源:origin: apache/flume

txn.rollback();
} catch (Exception e2) {
 logger.error("Exception in rollback. Rollback might not have been " +

代码示例来源:origin: apache/flume

txn.rollback();
} catch (Exception e2) {
 logger.error("Exception in rollback. Rollback might not have been " +

代码示例来源:origin: apache/flume

counterGroup.incrementAndGet("transaction.success");
} catch (Exception ex) {
 transaction.rollback();
 counterGroup.incrementAndGet("transaction.failed");
 logger.error("Failed to deliver event. Exception follows.", ex);

代码示例来源:origin: apache/flume

tx.rollback();
if (t instanceof Error) {
 LOG.error("Error while writing to required channel: " + reqChannel, t);
tx.rollback();
LOG.error("Unable to put event on optional channel: " + optChannel, t);
if (t instanceof Error) {

代码示例来源:origin: apache/flume

} finally {
 if (!success) {
  transaction.rollback();

代码示例来源:origin: apache/flume

transaction.rollback();
if (t instanceof Error) {
 throw (Error) t;

代码示例来源:origin: apache/flume

} catch (Throwable ex) {
 try {
  txn.rollback();
  counterGroup.incrementAndGet("transaction.rollback");
 } catch (Exception ex2) {

代码示例来源:origin: apache/flume

} finally {
 try {
  txn.rollback();
 } catch (Throwable t4) {
  LOGGER.error("Morphline Sink " + getName() + ": Unable to rollback Flume transaction. " +

代码示例来源:origin: apache/flume

} catch (Exception ex) {
 sinkCounter.incrementEventWriteOrChannelFail(ex);
 transaction.rollback();
 throw new EventDeliveryException("Failed to process transaction", ex);
} finally {

代码示例来源:origin: apache/flume

transaction.rollback();
 LOG.warn("HDFS IO error", eIO);
 sinkCounter.incrementEventWriteFail();
 return Status.BACKOFF;
} catch (Throwable th) {
 transaction.rollback();
 LOG.error("process failed", th);
 sinkCounter.incrementEventWriteOrChannelFail(th);

相关文章

微信公众号

最新文章

更多