org.fusesource.hawtdb.api
Interface Transaction

All Superinterfaces:
Paged

public interface Transaction
extends Paged

Provides transactional access to a Paged resource. The transaction provides snapshot isolation. The snapshot view of the entire page file is obtained the first time you read data from a page. Committed page updates from concurrent transactions will not be visible to the snapshot. The snapshot view of the page file is released once the transaction commits or is rolled back. Avoid holding a snapshot view for a long time. The page file cannot reclaim temporary processing space associated with a snapshot and subsequent snapshots while the snapshot is in use. Pages are optimistically updated, which means they are not locked for update. Updating a page or committing the transaction may fail with an if another committed transaction has updated the same page this transaction was trying to update.

Author:
Hiram Chirino

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.fusesource.hawtdb.api.Paged
Paged.SliceType
 
Method Summary
 void close()
          Closes a transaction object.
 void commit()
           
 boolean isReadOnly()
           
 void onFlush(java.lang.Runnable runnable)
          Committed transactions do not get written to physical media immediately, they get batched up with other Transaction to increase update throughput.
 void rollback()
           
 
Methods inherited from interface org.fusesource.hawtdb.api.Paged
alloc, allocator, clear, flush, free, get, getPageSize, pages, put, read, slice, unslice, write
 

Method Detail

isReadOnly

boolean isReadOnly()
Returns:
true if no updates have been performed by this transaction.

commit

void commit()
            throws OptimisticUpdateException
Throws:
OptimisticUpdateException - is thrown if the update would conflict with a concurrent updated performed by another thread.

rollback

void rollback()

close

void close()
Closes a transaction object. Throws an assertion error if the transaction is not already committed or rolledback. Attempts to use this transaction again will throw assertion errors.


onFlush

void onFlush(java.lang.Runnable runnable)
Committed transactions do not get written to physical media immediately, they get batched up with other Transaction to increase update throughput. Call this method with a Runnable if you want to get a callback when the transactions' updates are secured to physical media and therefore are known to survive a machine reboot.

Parameters:
runnable -


Copyright © 2009-2011 FuseSource, Corp.. All Rights Reserved.