Package org.apache.flume

Examples of org.apache.flume.Transaction.rollback()


          }
          result.add(new String(event.getBody(), Charsets.UTF_8));
        }
        transaction.commit();
      } catch (Exception ex) {
        transaction.rollback();
        throw ex;
      } finally {
        transaction.close();
      }
View Full Code Here


          batch.add(s);
        }
        transaction.commit();
        result.addAll(batch);
      } catch (Exception ex) {
        transaction.rollback();
        if(untilCapacityIsReached && ex instanceof ChannelException &&
            ("The channel has reached it's capacity. "
                + "This might be the result of a sink on the channel having too "
                + "low of batch size, a downstream system running slower than "
                + "normal, or that the channel capacity is just too low. "
View Full Code Here

      transaction.commit();
      sinkCounter.addToEventDrainSuccessCount(size);

    } catch (Throwable t) {
      transaction.rollback();
      if (t instanceof Error) {
        throw (Error) t;
      } else if (t instanceof ChannelException) {
        logger.error("Avro Sink " + getName() + ": Unable to get event from" +
            " channel " + channel.getName() + ". Exception follows.", t);
View Full Code Here

      txn.commit();
      sinkCounter.addToEventDrainSuccessCount(size);
      counterGroup.incrementAndGet("transaction.success");
    } catch (Throwable ex) {
      try {
        txn.rollback();
        counterGroup.incrementAndGet("transaction.rollback");
      } catch (Exception ex2) {
        logger.error(
            "Exception in rollback. Rollback might not have been successful.",
            ex2);
View Full Code Here

          memoryChannel.put(entry.getData());
          transaction.commit();
        } catch(Exception e) {
          if(transaction != null) {
            try {
              transaction.rollback();
            } catch(Exception ex) {
              LOG.info("Error during rollback", ex);
            }
          }
          Throwables.propagate(e);
View Full Code Here

          }
          Throwables.propagate(e);
        } catch(Error e) {
          if(transaction != null) {
            try {
              transaction.rollback();
            } catch(Exception ex) {
              LOG.info("Error during rollback", ex);
            }
          }
          throw e;
View Full Code Here

    Transaction transaction;
    // put an item we will rollback
    transaction = channel.getTransaction();
    transaction.begin();
    channel.put(EventBuilder.withBody("this is going to be rolledback".getBytes(Charsets.UTF_8)));
    transaction.rollback();
    transaction.close();

    while(t.isAlive()) {
      Thread.sleep(1);
    }
View Full Code Here

    Transaction transaction;
    // put an item we will rollback
    transaction = channel.getTransaction();
    transaction.begin();
    channel.put(EventBuilder.withBody("this is going to be rolledback".getBytes(Charsets.UTF_8)));
    transaction.rollback();
    transaction.close();

    // simulate crash
    channel.stop();
    channel = createFileChannel();
View Full Code Here

            return result;
          }
          result.add(new String(event.getBody(), Charsets.UTF_8));
          transaction.commit();
        } catch (Exception ex) {
          transaction.rollback();
          throw ex;
        } finally {
          transaction.close();
        }
      }
View Full Code Here

          Event event = EventBuilder.withBody(s.getBytes(Charsets.UTF_8));
          result.add(s);
          channel.put(event);
          transaction.commit();
        } catch (Exception ex) {
          transaction.rollback();
          throw ex;
        } finally {
          transaction.close();
        }
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.