org.exist.storage.txn
Class TransactionManager

java.lang.Object
  extended by org.exist.storage.txn.TransactionManager

public class TransactionManager
extends 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

Field Summary
static String PROPERTY_RECOVERY_FORCE_RESTART
           
static String PROPERTY_RECOVERY_GROUP_COMMIT
           
static String RECOVERY_FORCE_RESTART_ATTRIBUTE
           
static String RECOVERY_GROUP_COMMIT_ATTRIBUTE
           
 
Constructor Summary
TransactionManager(BrokerPool pool, 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()
           
 Lock getLock()
           
 void initialize()
           
 boolean isIdle()
           
 void processSystemTasks()
           
 void reindex(DBBroker broker)
           
 boolean runRecovery(DBBroker broker)
          Run a database recovery if required.
 void setEnabled(boolean enabled)
           
 void shutdown(boolean checkpoint)
           
 void triggerSystemTask(SystemTask task)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECOVERY_GROUP_COMMIT_ATTRIBUTE

public static final String RECOVERY_GROUP_COMMIT_ATTRIBUTE
See Also:
Constant Field Values

PROPERTY_RECOVERY_GROUP_COMMIT

public static final String PROPERTY_RECOVERY_GROUP_COMMIT
See Also:
Constant Field Values

RECOVERY_FORCE_RESTART_ATTRIBUTE

public static final String RECOVERY_FORCE_RESTART_ATTRIBUTE
See Also:
Constant Field Values

PROPERTY_RECOVERY_FORCE_RESTART

public static final String PROPERTY_RECOVERY_FORCE_RESTART
See Also:
Constant Field Values
Constructor Detail

TransactionManager

public TransactionManager(BrokerPool pool,
                          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)

isIdle

public boolean isIdle()

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.


commit

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

Parameters:
txn -
Throws:
TransactionException

abort

public void abort(Txn txn)

getLock

public Lock getLock()

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(boolean checkpoint)

triggerSystemTask

public void triggerSystemTask(SystemTask task)

processSystemTasks

public void processSystemTasks()


Copyright (C) Wolfgang Meier. All rights reserved.