Package org.apache.flume

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


      transaction.begin();
      channel.put(EventBuilder.withBody("overflow event".getBytes()));
      transaction.commit();
    } catch (ChannelException e) {
      overflowed = true;
      transaction.rollback();
    } finally {
      transaction.close();
    }
    Assert.assertTrue(overflowed);
View Full Code Here


      channelEvents.add(e);
    }
    try {
      txn.commit();
    } catch (Throwable t) {
      txn.rollback();
    } finally {
      txn.close();
    }
    //Since events can arrive out of order, search for each event in the array
    for (int i = 0; i < 1000 ; i++) {
View Full Code Here

    Transaction tx = channel.getTransaction();
    tx.begin();
    channel.put(EventBuilder.withBody("test".getBytes()));
    channel.put(EventBuilder.withBody("test".getBytes()));
    channel.put(EventBuilder.withBody("test".getBytes()));
    tx.rollback();
    tx.close();

    tx = channel.getTransaction();
    tx.begin();
    channel.put(EventBuilder.withBody("test".getBytes()));
View Full Code Here

    Transaction tx = channel.getTransaction();
    tx.begin();
    channel.put(EventBuilder.withBody(eventBody));
    channel.put(EventBuilder.withBody(eventBody));
    channel.put(EventBuilder.withBody(eventBody));
    tx.rollback();
    tx.close();

    tx = channel.getTransaction();
    tx.begin();
    channel.put(EventBuilder.withBody(eventBody));
View Full Code Here

    transaction.begin();
    for (putCounter = 0; putCounter < 10; putCounter++) {
      event = EventBuilder.withBody(("test event" + putCounter).getBytes());
      channel.put(event);
    }
    transaction.rollback();
    transaction.close();

    // verify that no events are stored due to rollback
    transaction = channel.getTransaction();
    transaction.begin();
View Full Code Here

      Assert.assertArrayEquals(event2.getBody(), ("test event" + i).getBytes());
    }
    event2 = channel.take();
    Assert.assertNull("extra event found", event2);

    transaction.rollback();
    transaction.close();

    // verify that the events were left in there due to rollback
    transaction = channel.getTransaction();
    transaction.begin();
View Full Code Here

      Assert.assertArrayEquals(event2.getBody(), ("test event" + i).getBytes());
    }
    event2 = channel.take();
    Assert.assertNull("extra event found", event2);

    transaction.rollback();
    transaction.close();
  }

  @Ignore("BasicChannelSemantics doesn't support re-entrant transactions")
  @Test
View Full Code Here

    transaction.begin();
    for (putCounter = 0; putCounter < 10; putCounter++) {
      event = EventBuilder.withBody(("test event" + putCounter).getBytes());
      channel.put(event);
    }
    transaction.rollback();
    transaction.close();

    // verify that no events are stored due to rollback
    transaction = channel.getTransaction();
    transaction.begin();
View Full Code Here

      transaction.commit(); // inner commit
    }
    event2 = channel.take();
    Assert.assertNull("extra event found", event2);

    transaction.rollback();
    transaction.close();

    // verify that the events were left in there due to rollback
    transaction = channel.getTransaction();
    transaction.begin();
View Full Code Here

      Assert.assertArrayEquals(event2.getBody(), ("test event" + i).getBytes());
    }
    event2 = channel.take();
    Assert.assertNull("extra event found", event2);

    transaction.rollback();
    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.