Home » activemq-parent-5.3.1-source-release » org.apache.kahadb.page » [javadoc | source]
org.apache.kahadb.page
public class: Transaction [javadoc | source]
java.lang.Object
   org.apache.kahadb.page.Transaction

All Implemented Interfaces:
    Iterable

The class used to read/update a PageFile object. Using a transaction allows you to do multiple update operations in a single unit of work.
Nested Class Summary:
public class  Transaction.PageOverflowIOException  The PageOverflowIOException occurs when a page write is requested and it's data is larger than what would fit into a single page. 
public class  Transaction.InvalidPageIOException  The InvalidPageIOException is thrown if try to load/store a a page with an invalid page id. 
public interface  Transaction.Closure  This closure interface is intended for the end user implement callbacks for the Transaction.exectue() method. 
public interface  Transaction.CallableClosure  This closure interface is intended for the end user implement callbacks for the Transaction.exectue() method. 
Constructor:
 Transaction(PageFile pageFile) 
Method from org.apache.kahadb.page.Transaction Summary:
allocate,   allocate,   commit,   execute,   execute,   free,   free,   free,   free,   getPageFile,   isReadOnly,   iterator,   iterator,   load,   load,   openInputStream,   openOutputStream,   rollback,   store
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.kahadb.page.Transaction Detail:
 public Page<T> allocate() throws IOException 
    Allocates a free page that you can write data to.
 public Page<T> allocate(int count) throws IOException 
    Allocates a block of free pages that you can write data to.
 public  void commit() throws IOException 
    Commits the transaction to the PageFile as a single 'Unit of Work'. Either all page updates associated with the transaction are written to disk or none will.
 public  void execute(Closure<T> closure) throws T, IOException 
    Executes a closure and if it does not throw any exceptions, then it commits the transaction. If the closure throws an Exception, then the transaction is rolled back.
 public R execute(CallableClosure<R, T> closure) throws T, IOException 
    Executes a closure and if it does not throw any exceptions, then it commits the transaction. If the closure throws an Exception, then the transaction is rolled back.
 public  void free(long pageId) throws IOException 
    Frees up a previously allocated page so that it can be re-allocated again.
 public  void free(Page<T> page) throws IOException 
    Frees up a previously allocated page so that it can be re-allocated again.
 public  void free(long pageId,
    int count) throws IOException 
    Frees up a previously allocated sequence of pages so that it can be re-allocated again.
 public  void free(Page<T> page,
    int count) throws IOException 
    Frees up a previously allocated sequence of pages so that it can be re-allocated again.
 public PageFile getPageFile() 
 public boolean isReadOnly() 
 public Iterator<Page> iterator() 
    Allows you to iterate through all active Pages in this object. Pages with type Page.FREE_TYPE are not included in this iteration. Pages removed with Iterator.remove() will not actually get removed until the transaction commits.
 public Iterator<Page> iterator(boolean includeFreePages) 
    Allows you to iterate through all active Pages in this object. You can optionally include free pages in the pages iterated.
 public Page<T> load(long pageId,
    Marshaller<T> marshaller) throws IOException 
    Loads a page from disk.
 public  void load(Page<T> page,
    Marshaller<T> marshaller) throws IOException 
    Loads a page from disk.
 public InputStream openInputStream(Page p) throws IOException 
 public OutputStream openOutputStream(Page page,
    boolean overflow) throws IOException 
 public  void rollback() throws IOException 
    Rolls back the transaction.
 public  void store(Page<T> page,
    Marshaller<T> marshaller,
    boolean overflow) throws IOException