org.apache.derby.iapi.store.raw.xact
Interface TransactionFactory

All Superinterfaces:
Corruptable
All Known Implementing Classes:
ConcurrentXactFactory, XactFactory

public interface TransactionFactory
extends Corruptable

This module is intended to be used only within the RawStore. RawStore functionality is accessed only through the RawStoreFactory interface. The transaction manager is responsible for:

See Also:
RawStoreFactory, Transaction

Field Summary
static java.lang.String MODULE
           
 
Method Summary
 boolean blockBackupBlockingOperations(boolean wait)
          Checks if there any backup blocking operations are in progress and prevents new ones from starting until the backup is finished.
 void createFinished()
          Database creation finished
 boolean findTransaction(TransactionId id, RawTransaction tran)
          Find a transaction using a transactionId and make the passed in transaction assume the identity and properties of that transaction.
 RawTransaction findUserTransaction(RawStoreFactory rsf, ContextManager contextMgr, java.lang.String transName)
          Find a user transaction within the given raw store and the given contextMgr.
 LogInstant firstUpdateInstant()
          The first log instant that belongs to a transaction that is still active in the raw store.
 LockFactory getLockFactory()
          Get the LockFactory to use with this store.
 TransactionInfo[] getTransactionInfo()
           
 Formatable getTransactionTable()
          Return the transaction table so it can get logged with the checkpoint log record.
 java.lang.Object getXAResourceManager()
          Return the module providing XAresource interface to the transaction table.
 void handlePreparedXacts(RawStoreFactory rsf)
          Run through all prepared transactions known to this factory and restore their state such that they remain after recovery, and can be found and handled by a XA transaction manager.
 boolean hasPreparedXact()
          Check if there are any prepared transanctions.
 boolean noActiveUpdateTransaction()
          Returns true if the transaction factory has no active updating transaction
 void resetTranId()
          Reset any resettable transaction Id
 void rollbackAllTransactions(RawTransaction recoveryTransaction, RawStoreFactory rsf)
          Rollback and close all transactions known to this factory using a passed in transaction.
 void setRawStoreFactory(RawStoreFactory rsf)
          make Transaction factory aware of which raw store factory it belongs to
 RawTransaction startGlobalTransaction(RawStoreFactory rsf, ContextManager contextMgr, int format_id, byte[] global_id, byte[] branch_id)
          Start a new transaction within the given raw store.
 RawTransaction startInternalTransaction(RawStoreFactory rsf, ContextManager contextMgr)
          Start a new internal transaction within the given raw store.
 RawTransaction startNestedReadOnlyUserTransaction(RawStoreFactory rsf, CompatibilitySpace compatibilitySpace, ContextManager contextMgr, java.lang.String transName)
          Start a new read only transaction within the given raw store.
 RawTransaction startNestedTopTransaction(RawStoreFactory rsf, ContextManager contextMgr)
          Start a new nested top transaction within the given raw store.
 RawTransaction startNestedUpdateUserTransaction(RawStoreFactory rsf, ContextManager contextMgr, java.lang.String transName)
          Start a new update transaction within the given raw store.
 RawTransaction startTransaction(RawStoreFactory rsf, ContextManager contextMgr, java.lang.String transName)
          Start a new transaction within the given raw store.
 boolean submitPostCommitWork(Serviceable work)
          Submit a post commit work to the post commit daemon.
 void unblockBackupBlockingOperations()
          Backup completed.
 void useTransactionTable(Formatable transactionTable)
          Use this transaction table, which is gotten from a checkpoint operation.
 
Methods inherited from interface org.apache.derby.iapi.store.raw.Corruptable
markCorrupt
 

Field Detail

MODULE

static final java.lang.String MODULE
See Also:
Constant Field Values
Method Detail

getLockFactory

LockFactory getLockFactory()
Get the LockFactory to use with this store.


getXAResourceManager

java.lang.Object getXAResourceManager()
                                      throws StandardException
Return the module providing XAresource interface to the transaction table.

Throws:
StandardException - Standard Derby exception policy.

startTransaction

RawTransaction startTransaction(RawStoreFactory rsf,
                                ContextManager contextMgr,
                                java.lang.String transName)
                                throws StandardException
Start a new transaction within the given raw store. This method will push a transaction context as described in RawStoreFactory.startTransaction

Parameters:
contextMgr - is the context manager to use. It must be the current context manager.
transName - is the transaction name. It will be displayed in the transactiontable VTI.
Throws:
StandardException - Standard Derby error policy.
See Also:
RawStoreFactory.startTransaction(org.apache.derby.iapi.services.context.ContextManager, java.lang.String)

startNestedReadOnlyUserTransaction

RawTransaction startNestedReadOnlyUserTransaction(RawStoreFactory rsf,
                                                  CompatibilitySpace compatibilitySpace,
                                                  ContextManager contextMgr,
                                                  java.lang.String transName)
                                                  throws StandardException
Start a new read only transaction within the given raw store. This method will push a transaction context as described in RawStoreFactory.startNestedTransaction

Parameters:
compatibilitySpace - compatibility space to use for locks.
contextMgr - is the context manager to use. It must be the current context manager.
transName - is the transaction name. It will be displayed in the transactiontable VTI.
Throws:
StandardException - Standard Derby error policy.
See Also:
RawStoreFactory.startNestedReadOnlyUserTransaction(org.apache.derby.iapi.services.locks.CompatibilitySpace, org.apache.derby.iapi.services.context.ContextManager, java.lang.String)

startNestedUpdateUserTransaction

RawTransaction startNestedUpdateUserTransaction(RawStoreFactory rsf,
                                                ContextManager contextMgr,
                                                java.lang.String transName)
                                                throws StandardException
Start a new update transaction within the given raw store. This method will push a transaction context as described in RawStoreFactory.startNestedTransaction

Parameters:
contextMgr - is the context manager to use. It must be the current context manager.
transName - is the transaction name. It will be displayed in the transactiontable VTI.
Throws:
StandardException - Standard Derby error policy.
See Also:
RawStoreFactory.startNestedUpdateUserTransaction(org.apache.derby.iapi.services.context.ContextManager, java.lang.String)

startGlobalTransaction

RawTransaction startGlobalTransaction(RawStoreFactory rsf,
                                      ContextManager contextMgr,
                                      int format_id,
                                      byte[] global_id,
                                      byte[] branch_id)
                                      throws StandardException
Start a new transaction within the given raw store. This method will push a transaction context as described in RawStoreFactory.startTransaction

Parameters:
format_id - the format id part of the Xid - ie. Xid.getFormatId().
global_id - the global transaction identifier part of XID - ie. Xid.getGlobalTransactionId().
branch_id - The branch qualifier of the Xid - ie. Xid.getBranchQaulifier()
contextMgr - is the context manager to use. It must be the current context manager.
Throws:
StandardException - Standard Derby error policy.
See Also:
RawStoreFactory.startGlobalTransaction(org.apache.derby.iapi.services.context.ContextManager, int, byte[], byte[])

findUserTransaction

RawTransaction findUserTransaction(RawStoreFactory rsf,
                                   ContextManager contextMgr,
                                   java.lang.String transName)
                                   throws StandardException
Find a user transaction within the given raw store and the given contextMgr. If no user transaction exist, then start one with name transName. This method will push a transaction context as described in RawStoreFactory.startTransaction

Throws:
StandardException - Standard Derby error policy.
See Also:
RawStoreFactory.findUserTransaction(org.apache.derby.iapi.services.context.ContextManager, java.lang.String), RawStoreFactory.startTransaction(org.apache.derby.iapi.services.context.ContextManager, java.lang.String)

startNestedTopTransaction

RawTransaction startNestedTopTransaction(RawStoreFactory rsf,
                                         ContextManager contextMgr)
                                         throws StandardException
Start a new nested top transaction within the given raw store. This method will push a transaction context as described in RawStoreFactory.startNestedTopTransaction

Throws:
StandardException - Standard Derby error policy.
See Also:
RawStoreFactory.startTransaction(ContextManager, String)

startInternalTransaction

RawTransaction startInternalTransaction(RawStoreFactory rsf,
                                        ContextManager contextMgr)
                                        throws StandardException
Start a new internal transaction within the given raw store. This method will push a transaction context as described in RawStoreFactory.startInternalTransaction

Throws:
StandardException - Standard Derby error policy.
See Also:
RawStoreFactory.startTransaction(org.apache.derby.iapi.services.context.ContextManager, java.lang.String)

findTransaction

boolean findTransaction(TransactionId id,
                        RawTransaction tran)
Find a transaction using a transactionId and make the passed in transaction assume the identity and properties of that transaction. Used in recovery only.


resetTranId

void resetTranId()
                 throws StandardException
Reset any resettable transaction Id

Throws:
StandardException - Standard Derby error policy.

firstUpdateInstant

LogInstant firstUpdateInstant()
The first log instant that belongs to a transaction that is still active in the raw store. This is the first log record of the longest running transaction at this moment.


handlePreparedXacts

void handlePreparedXacts(RawStoreFactory rsf)
                         throws StandardException
Run through all prepared transactions known to this factory and restore their state such that they remain after recovery, and can be found and handled by a XA transaction manager. This includes creating a context manager for each, pushing a xact context, and reclaiming update locks on all data changed by the transaction. Used only in recovery.

Throws:
StandardException - Derby Standard Error policy

rollbackAllTransactions

void rollbackAllTransactions(RawTransaction recoveryTransaction,
                             RawStoreFactory rsf)
                             throws StandardException
Rollback and close all transactions known to this factory using a passed in transaction. Used only in recovery.

Parameters:
recoveryTransaction - the transaction used to rollback
Throws:
StandardException - Derby Standard Error policy

submitPostCommitWork

boolean submitPostCommitWork(Serviceable work)
Submit a post commit work to the post commit daemon. The work is always added to the deamon, regardless of the state it returns.

Returns:
true if the daemon indicates it is being overloaded, false it's happy. must be MT-safe

setRawStoreFactory

void setRawStoreFactory(RawStoreFactory rsf)
                        throws StandardException
make Transaction factory aware of which raw store factory it belongs to

Throws:
StandardException

noActiveUpdateTransaction

boolean noActiveUpdateTransaction()
Returns true if the transaction factory has no active updating transaction


hasPreparedXact

boolean hasPreparedXact()
Check if there are any prepared transanctions.

MT - unsafe, called during boot, which is single threaded.

Returns:
true if prepared transactions exist, false otherwise.

createFinished

void createFinished()
                    throws StandardException
Database creation finished

Throws:
StandardException - Standard Derby exception policy.

getTransactionTable

Formatable getTransactionTable()
Return the transaction table so it can get logged with the checkpoint log record.


useTransactionTable

void useTransactionTable(Formatable transactionTable)
                         throws StandardException
Use this transaction table, which is gotten from a checkpoint operation. Use ONLY during recovery.

Throws:
StandardException - Standard Derby exception policy.

getTransactionInfo

TransactionInfo[] getTransactionInfo()
See Also:
AccessFactory.getTransactionInfo()

blockBackupBlockingOperations

boolean blockBackupBlockingOperations(boolean wait)
                                      throws StandardException
Checks if there any backup blocking operations are in progress and prevents new ones from starting until the backup is finished.

Parameters:
wait - if true, waits for the current backup blocking operations in progress to finish.
Returns:
true if there are no backup blocking operations in progress. false otherwise.
Throws:
StandardException - if interrupted or a runtime exception occurs.

unblockBackupBlockingOperations

void unblockBackupBlockingOperations()
Backup completed. Allow backup blocking operations.


Built on Thu 2011-03-10 11:54:14+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.