TransactionBuilder (Neo4j Community 1.8.RC1 API)
Date: 2012-09-07

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Neo4j Community
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.neo4j.kernel
Interface TransactionBuilder

    public interface TransactionBuilder

A builder for controlling certain behaviors of a transaction. Methods that return `TransactionBuilder` returns a new instance with the updated configuration that the method call modified. When the behavior is as desired a call to `begin()` will begin the transaction and return a `Transaction`.

     // To begin a transaction with default behavior
     Transaction tx = graphDb.tx().begin();

     // To begin a transaction with relaxed force
     Transaction tx = graphDb.tx().relaxed().begin();

     // To have relaxed force optionally set by a condition
     TransactionBuilder txBuilder = graphDb.tx();
     if ( condition )
     {
         txBuilder = txBuilder.relaxed();
     }
     Transaction tx = txBuilder.begin();

Author:
  Mattias Persson

Method Summary
`Transaction` | `begin()` Starts a new transaction and associates it with the current thread.
`TransactionBuilder` | `unforced()` Relaxes the forcing constraint of the logical logs for this transaction so that the data is written out, but not forced to disk.

Method Detail

### begin

    Transaction begin()

  Starts a new transaction and associates it with the current thread.

  Returns:
    a new transaction instance

### unforced

    TransactionBuilder unforced()

  Relaxes the forcing constraint of the logical logs for this transaction so that the data is written out, but not forced to disk. Pros
  - The overhead of committing a transaction is lowered due to the removal of the force, i.e. I/O waiting for the disk to actually write the bytes down. The smaller the transaction the bigger percentage of it is spent forcing the logical logs to disk, so small transactions get most benefit from being unforced.
  Cons
  - Since there's no guarantee that the data is actually written down to disk the data provided in this transaction could be lost in the event of power failure or similar. It is however guaranteed that the data that has been written to disk is consistent so the worst case scenario for unforced transactions is that a couple of seconds (depending on write load) worth of data might be lost in an event of power failure, but the database will still get back to a consistent state after a recovery.

  Returns:
    a `TransactionBuilder` instance with relaxed force set.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Neo4j Community
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.