org.exist.storage.txn
Class TransactionManager

java.lang.Object
  extended byorg.exist.storage.txn.TransactionManager

public class TransactionManager
extends java.lang.Object

This is the central entry point to the transaction management service. There's only one TransactionManager per database instance that can be retrieved via BrokerPool.getTransactionManager(). TransactionManager provides methods to create, commit and rollback a transaction.

Author:
wolf

Constructor Summary
TransactionManager(BrokerPool pool, java.io.File dataDir, boolean transactionsEnabled)
          Initialize the transaction manager using the specified data directory.
 
Method Summary
 void abort(Txn txn)
           
 Txn beginTransaction()
          Create a new transaction.
 void checkpoint(boolean switchFiles)
          Create a new checkpoint.
 void commit(Txn txn)
          Commit a transaction.
 Journal getJournal()
           
 void initialize()
           
 void reindex(DBBroker broker)
           
 boolean runRecovery(DBBroker broker)
          Run a database recovery if required.
 void setEnabled(boolean enabled)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionManager

public TransactionManager(BrokerPool pool,
                          java.io.File dataDir,
                          boolean transactionsEnabled)
                   throws EXistException
Initialize the transaction manager using the specified data directory.

Parameters:
dataDir -
Throws:
EXistException
Method Detail

initialize

public void initialize()
                throws EXistException,
                       ReadOnlyException
Throws:
EXistException
ReadOnlyException

setEnabled

public void setEnabled(boolean enabled)

runRecovery

public boolean runRecovery(DBBroker broker)
                    throws EXistException
Run a database recovery if required. This method is called once during startup from BrokerPool.

Parameters:
broker -
Throws:
EXistException

beginTransaction

public Txn beginTransaction()
Create a new transaction. Creates a new transaction id that will be logged to disk immediately.

Throws:
TransactionException

commit

public void commit(Txn txn)
            throws TransactionException
Commit a transaction.

Parameters:
txn -
Throws:
TransactionException

abort

public void abort(Txn txn)

checkpoint

public void checkpoint(boolean switchFiles)
                throws TransactionException
Create a new checkpoint. A checkpoint fixes the current database state. All dirty pages are written to disk and the journal file is cleaned. This method is called from BrokerPool within pre-defined periods. It should not be called from somewhere else. The database needs to be in a stable state (all transactions completed, no operations running).

Throws:
TransactionException

getJournal

public Journal getJournal()

reindex

public void reindex(DBBroker broker)

shutdown

public void shutdown()


Copyright (C) Wolfgang Meier. All rights reserved.