Package org.helidb.txn

Examples of org.helidb.txn.Transaction.commit()


        db.insert(3, 30L);
        txn.commit();

        txn = Transaction.startTransaction(false);
        db.delete(2);
        txn.commit();

        txn = Transaction.startTransaction(true);
        assertEquals(2, db.size());
        assertEquals(30L, db.get(3).longValue());
        assertEquals(10L, db.get(1).longValue());
View Full Code Here


      try
      {
        db.insert(1, 10L);
        db.insert(2, 20L);
        db.insert(3, 30L);
        txn.commit();

        txn = Transaction.startTransaction(false);
        db.delete(2);
        txn.rollback();
View Full Code Here

      Transaction txn = Transaction.startTransaction(false);
      try
      {
        db.insert(1, 10L);
        db.insert(2, 20L);
        txn.commit();

        txn = Transaction.startTransaction(false);
        db.update(1, 1000L);
        db.update(1, 10000L);
        txn.commit();
View Full Code Here

        txn.commit();

        txn = Transaction.startTransaction(false);
        db.update(1, 1000L);
        db.update(1, 10000L);
        txn.commit();

        txn = Transaction.startTransaction(true);
        assertEquals(2, db.size());
        assertEquals(20L, db.get(2).longValue());
        assertEquals(10000L, db.get(1).longValue());
View Full Code Here

      Transaction txn = Transaction.startTransaction(false);
      try
      {
        db.insert(1, 10L);
        db.insert(2, 20L);
        txn.commit();

        txn = Transaction.startTransaction(false);
        db.update(1, 100L);
        db.update(2, 200L);
        txn.commit();
View Full Code Here

        txn.commit();

        txn = Transaction.startTransaction(false);
        db.update(1, 100L);
        db.update(2, 200L);
        txn.commit();

        txn = Transaction.startTransaction(false);
        db.update(1, 1000L);
        db.update(1, 10000L);
        txn.rollback();
View Full Code Here

          injectCannotCommit(txn.getCollaborator(db2));

          try
          {
            txn.commit();
            fail();
          }
          catch (UnableToCommitException e)
          {
            assertTrue(e.getMessage().contains("inject"));
View Full Code Here

  @Test
  public void testClearTransactionAtCommit()
  {
    Transaction txn = Transaction.startTransaction(false);
    assertSame(txn, Transaction.getCurrentTransaction());
    txn.commit();
    assertNull(Transaction.getCurrentTransactionOrNull());
  }

  @Test
  public void testClearTransactionAtRollback()
View Full Code Here

    {
      db.fasterInsert("key1", "value1");
      db.fasterInsert("key10", "value10");
      assertEquals("value1", db.get("key1"));
      assertEquals("value10", db.get("key10"));
      txn.commit();
      successful = true;
    }
    finally
    {
      if (!successful)
View Full Code Here

        assertNull(db.get("key11"));
      }
      finally
      {
        txn.commit();
      }

      txn = Transaction.startTransaction(true);
      try
      {
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.