com.caucho.db.xa
Class DbTransaction

java.lang.Object
  extended by com.caucho.db.xa.StoreTransaction
      extended by com.caucho.db.xa.DbTransaction

public class DbTransaction
extends StoreTransaction

Represents a single transaction.


Method Summary
 void addAddInode(Inode inode)
          Adds inode which should be deleted on a rollback.
 void addDeleteInode(Inode inode)
          Adds inode which should be deleted on a commit.
 void addUpdateBlock(Block block)
          Adds a block for update.
 Block allocateRow(BlockStore store)
          Returns a modified block.
 void autoCommit()
           
 void autoCommitRead(DatabaseLock lock)
          If auto-commit, commit the read
 void autoCommitWrite(DatabaseLock lock)
          If auto-commit, commit the write
 void commit()
           
static DbTransaction create()
           
static DbTransaction create(ConnectionImpl conn)
           
 void deallocateBlock(Block block)
          Returns a modified block.
 long getTimeout()
           
 boolean hasReadLock(DatabaseLock lock)
          Acquires a new read lock.
 boolean isAutoCommit()
          Returns true for an auto-commit transaction.
 Block loadBlock(BlockStore store, long blockAddress)
          Returns a read block.
 void lockRead(DatabaseLock lock)
          Acquires a new write lock.
 void lockReadAndWrite(DatabaseLock lock)
          Acquires a new write lock.
 boolean lockReadAndWriteNoWait(DatabaseLock lock)
          Conditionally a new write lock, if no contention exists.
 Block readBlock(BlockStore store, long blockAddress)
          Returns a read block.
 void rollback()
           
 void setAutoCommit(boolean autoCommit)
          Returns true for an auto-commit transaction.
 void setRollbackOnly()
           
 void setRollbackOnly(java.sql.SQLException e)
           
 void setTimeout(long timeout)
          Sets the transaction timeout.
 void unlockRead(DatabaseLock lock)
           
 void unlockReadAndWrite(DatabaseLock lock)
           
 void writeData()
           
 
Methods inherited from class com.caucho.db.xa.StoreTransaction
addUpdateFragmentBlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static DbTransaction create(ConnectionImpl conn)

create

public static DbTransaction create()

setTimeout

public void setTimeout(long timeout)
Sets the transaction timeout.


getTimeout

public long getTimeout()

hasReadLock

public boolean hasReadLock(DatabaseLock lock)
Acquires a new read lock.


isAutoCommit

public boolean isAutoCommit()
Returns true for an auto-commit transaction.


setAutoCommit

public void setAutoCommit(boolean autoCommit)
Returns true for an auto-commit transaction.


lockRead

public void lockRead(DatabaseLock lock)
              throws java.sql.SQLException
Acquires a new write lock.

Throws:
java.sql.SQLException

lockReadAndWrite

public void lockReadAndWrite(DatabaseLock lock)
                      throws java.sql.SQLException
Acquires a new write lock.

Throws:
java.sql.SQLException

lockReadAndWriteNoWait

public boolean lockReadAndWriteNoWait(DatabaseLock lock)
                               throws java.sql.SQLException
Conditionally a new write lock, if no contention exists.

Throws:
java.sql.SQLException

addUpdateBlock

public void addUpdateBlock(Block block)
Adds a block for update.

Specified by:
addUpdateBlock in class StoreTransaction

autoCommitRead

public void autoCommitRead(DatabaseLock lock)
                    throws java.sql.SQLException
If auto-commit, commit the read

Throws:
java.sql.SQLException

unlockRead

public void unlockRead(DatabaseLock lock)
                throws java.sql.SQLException
Throws:
java.sql.SQLException

autoCommitWrite

public void autoCommitWrite(DatabaseLock lock)
                     throws java.sql.SQLException
If auto-commit, commit the write

Throws:
java.sql.SQLException

unlockReadAndWrite

public void unlockReadAndWrite(DatabaseLock lock)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

readBlock

public Block readBlock(BlockStore store,
                       long blockAddress)
                throws java.io.IOException
Returns a read block.

Specified by:
readBlock in class StoreTransaction
Throws:
java.io.IOException

loadBlock

public Block loadBlock(BlockStore store,
                       long blockAddress)
                throws java.io.IOException
Returns a read block.

Throws:
java.io.IOException

allocateRow

public Block allocateRow(BlockStore store)
                  throws java.io.IOException
Returns a modified block.

Throws:
java.io.IOException

deallocateBlock

public void deallocateBlock(Block block)
                     throws java.io.IOException
Returns a modified block.

Throws:
java.io.IOException

addDeleteInode

public void addDeleteInode(Inode inode)
Adds inode which should be deleted on a commit.


addAddInode

public void addAddInode(Inode inode)
Adds inode which should be deleted on a rollback.


autoCommit

public void autoCommit()
                throws java.sql.SQLException
Throws:
java.sql.SQLException

setRollbackOnly

public void setRollbackOnly(java.sql.SQLException e)

setRollbackOnly

public void setRollbackOnly()

commit

public void commit()
            throws java.sql.SQLException
Throws:
java.sql.SQLException

writeData

public void writeData()
               throws java.sql.SQLException
Throws:
java.sql.SQLException

rollback

public void rollback()
              throws java.sql.SQLException
Throws:
java.sql.SQLException