/** * 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; } } }
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(); } }
interrupted = Thread.currentThread().isInterrupted(); try { transaction.rollback(); } catch (Throwable e2) { logger.error("Failed to roll back transaction, exception follows:", e2);
transaction.rollback();
@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; } }
txn.rollback(); } catch (Exception e2) { logger.error("Exception in rollback. Rollback might not have been " +
txn.rollback(); } catch (Exception e2) { logger.error("Exception in rollback. Rollback might not have been " +
counterGroup.incrementAndGet("transaction.success"); } catch (Exception ex) { transaction.rollback(); counterGroup.incrementAndGet("transaction.failed"); logger.error("Failed to deliver event. Exception follows.", ex);
} finally { if (!success) { transaction.rollback();
transaction.rollback(); if (t instanceof Error) { throw (Error) t;
} catch (Throwable ex) { try { txn.rollback(); counterGroup.incrementAndGet("transaction.rollback"); } catch (Exception ex2) {
} finally { try { txn.rollback(); } catch (Throwable t4) { LOGGER.error("Morphline Sink " + getName() + ": Unable to rollback Flume transaction. " +
} catch (Exception ex) { sinkCounter.incrementEventWriteOrChannelFail(ex); transaction.rollback(); throw new EventDeliveryException("Failed to process transaction", ex); } finally {