Java Doc for Txn.java in  » JMX » je » com » sleepycat » je » txn » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » JMX » je » com.sleepycat.je.txn 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sleepycat.je.txn.Locker
      com.sleepycat.je.txn.Txn

All known Subclasses:   com.sleepycat.je.txn.AutoTxn,
Txn
public class Txn extends Locker implements Loggable(Code)
A Txn is one that's created by a call to Environment.txnBegin. This class must support multithreaded use.


Field Summary
public static  intACCUMULATED_LIMIT
    
final public static  byteTXN_NOSYNC
    
final public static  byteTXN_SYNC
    
final public static  byteTXN_WRITE_NOSYNC
    

Constructor Summary
public  Txn(EnvironmentImpl envImpl, TransactionConfig config)
     Create a transaction from Environment.txnBegin.
public  Txn(EnvironmentImpl envImpl, TransactionConfig config, long id)
    
public  Txn()
     Constructor for reading from log.

Method Summary
public  voidabort(Xid xid)
    
public  longabort(boolean forceFlush)
     Abort this transaction.
 voidaddLock(Long nodeId, LockType type, LockGrantType grantStatus)
     Add lock to the appropriate queue.
public  voidaddLogInfo(long lastLsn)
     Called by the recovery manager when logging a transaction aware object. This method is synchronized by the caller, by being called within the log latch.
protected  voidcheckState(boolean calledByAbort)
     Throw an exception if the transaction is not open.
public  LockStatscollectStats(LockStats stats)
    
public  voidcommit(Xid xid)
    
public  longcommit()
     Call commit() with the default sync configuration property.
public  longcommit(byte flushSyncBehavior)
     Commit this transaction 1.
public  booleancreatedNode(long nodeId)
     true if this transaction created this node.
public  voiddumpLog(StringBuffer sb, boolean verbose)
    
protected  longgenerateId(TxnManager txnManager)
     UserTxns get a new unique id for each instance.
public  longgetAbortLsn(long nodeId)
    
 intgetAccumulatedDelta()
    
 longgetFirstActiveLsn()
    
 intgetInMemorySize()
    
 longgetLastLsn()
     Access to last LSN.
public  intgetLogSize()
    
public  booleangetOnlyAbortable()
     Get the state of a transaction's ONLY_ABORTABLE.
public  booleangetPrepared()
    
public  longgetTransactionId()
    
public  TxngetTxnLocker()
     This is a transactional locker.
public  WriteLockInfogetWriteLockInfo(long nodeId)
    
public  booleanisHandleLockTransferrable()
    
public  booleanisReadCommittedIsolation()
     Is read-committed isolation if so configured.
public  booleanisSerializableIsolation()
     Is serializable isolation if so configured.
public  booleanisSuspended()
    
public  booleanisTransactional()
     Is always transactional.
 LockResultlockInternal(long nodeId, LockType lockType, boolean noWait, DatabaseImpl database)
     Gets a lock on this nodeId and, if it is a write lock, saves an abort LSN.
public  voidmarkDeleteAtTxnEnd(DatabaseImpl dbImpl, boolean deleteAtCommit)
    
 voidmoveWriteToReadLock(long nodeId, Lock lock)
     A lock is being demoted.
public  LockernewNonTxnLocker()
     Returns 'this', since this locker holds no non-transactional locks.
public  voidoperationEnd()
     Created transactions do nothing at the end of the operation.
public  voidoperationEnd(boolean operationOK)
     Created transactions do nothing at the end of the operation.
public  intprepare(Xid xid)
    
public  voidreadFromLog(ByteBuffer logBuffer, byte entryTypeVersion)
    
public  voidregisterCursor(CursorImpl cursor)
     Cursors operating under this transaction are added to the collection.
public  voidreleaseNonTxnLocks()
     This locker holds no non-transactional locks.
 voidremoveLock(long nodeId)
     Remove the lock from the set owned by this transaction.
public  voidsetHandleLockOwner(boolean ignore, Database dbHandle, boolean dbIsClosing)
     Created transactions don't transfer locks until commit.
public  voidsetOnlyAbortable()
     Set the state of a transaction to ONLY_ABORTABLE.
public  voidsetPrepared(boolean prepared)
    
public  voidsetSuspended(boolean suspended)
    
public  voidunRegisterCursor(CursorImpl cursor)
     Remove a cursor from the collection.
public  voidwriteToLog(ByteBuffer logBuffer)
    

Field Detail
ACCUMULATED_LIMIT
public static int ACCUMULATED_LIMIT(Code)



TXN_NOSYNC
final public static byte TXN_NOSYNC(Code)



TXN_SYNC
final public static byte TXN_SYNC(Code)



TXN_WRITE_NOSYNC
final public static byte TXN_WRITE_NOSYNC(Code)




Constructor Detail
Txn
public Txn(EnvironmentImpl envImpl, TransactionConfig config) throws DatabaseException(Code)
Create a transaction from Environment.txnBegin.



Txn
public Txn(EnvironmentImpl envImpl, TransactionConfig config, long id) throws DatabaseException(Code)



Txn
public Txn()(Code)
Constructor for reading from log.




Method Detail
abort
public void abort(Xid xid) throws DatabaseException(Code)



abort
public long abort(boolean forceFlush) throws DatabaseException(Code)
Abort this transaction. Steps are: 1. Release LN read locks. 2. Write a txn abort entry to the log. This is only for log file cleaning optimization and there's no need to guarantee a flush to disk. 3. Find the last LN log entry written for this txn, and use that to traverse the log looking for nodes to undo. For each node, use the same undo logic as recovery to rollback the transaction. Note that we walk the log in order to undo in reverse order of the actual operations. For example, suppose the txn did this: delete K1/D1 (in LN 10) create K1/D1 (in LN 20) If we process LN10 before LN 20, we'd inadvertently create a duplicate tree of "K1", which would be fatal for the mapping tree. 4. Release the write lock for this LN.



addLock
void addLock(Long nodeId, LockType type, LockGrantType grantStatus) throws DatabaseException(Code)
Add lock to the appropriate queue.



addLogInfo
public void addLogInfo(long lastLsn) throws DatabaseException(Code)
Called by the recovery manager when logging a transaction aware object. This method is synchronized by the caller, by being called within the log latch. Record the last LSN for this transaction, to create the transaction chain, and also record the LSN in the write info for abort logic.



checkState
protected void checkState(boolean calledByAbort) throws DatabaseException(Code)
Throw an exception if the transaction is not open. If calledByAbort is true, it means we're being called from abort(). Caller must invoke with "this" synchronized.



collectStats
public LockStats collectStats(LockStats stats) throws DatabaseException(Code)
stats



commit
public void commit(Xid xid) throws DatabaseException(Code)



commit
public long commit() throws DatabaseException(Code)
Call commit() with the default sync configuration property.



commit
public long commit(byte flushSyncBehavior) throws DatabaseException(Code)
Commit this transaction 1. Releases read locks 2. Writes a txn commit record into the log 3. Flushes the log to disk. 4. Add deleted LN info to IN compressor queue 5. Release all write locks If any step of this fails, we must convert this transaction to an abort.



createdNode
public boolean createdNode(long nodeId) throws DatabaseException(Code)
true if this transaction created this node. We know that thisis true if the node is write locked and has a null abort LSN.



dumpLog
public void dumpLog(StringBuffer sb, boolean verbose)(Code)

See Also:   Loggable.dumpLog



generateId
protected long generateId(TxnManager txnManager)(Code)
UserTxns get a new unique id for each instance.



getAbortLsn
public long getAbortLsn(long nodeId) throws DatabaseException(Code)
the abortLsn for this node.



getAccumulatedDelta
int getAccumulatedDelta()(Code)



getFirstActiveLsn
long getFirstActiveLsn() throws DatabaseException(Code)
first logged LSN, to aid recovery rollback.



getInMemorySize
int getInMemorySize()(Code)



getLastLsn
long getLastLsn()(Code)
Access to last LSN.



getLogSize
public int getLogSize()(Code)

See Also:   Loggable.getLogSize



getOnlyAbortable
public boolean getOnlyAbortable()(Code)
Get the state of a transaction's ONLY_ABORTABLE.



getPrepared
public boolean getPrepared()(Code)



getTransactionId
public long getTransactionId()(Code)

See Also:   Loggable.getTransactionId



getTxnLocker
public Txn getTxnLocker()(Code)
This is a transactional locker.



getWriteLockInfo
public WriteLockInfo getWriteLockInfo(long nodeId) throws DatabaseException(Code)
the WriteLockInfo for this node.



isHandleLockTransferrable
public boolean isHandleLockTransferrable()(Code)
true if this txn is willing to give up the handle lock toanother txn before this txn ends.



isReadCommittedIsolation
public boolean isReadCommittedIsolation()(Code)
Is read-committed isolation if so configured.



isSerializableIsolation
public boolean isSerializableIsolation()(Code)
Is serializable isolation if so configured.



isSuspended
public boolean isSuspended()(Code)



isTransactional
public boolean isTransactional()(Code)
Is always transactional.



lockInternal
LockResult lockInternal(long nodeId, LockType lockType, boolean noWait, DatabaseImpl database) throws DatabaseException(Code)
Gets a lock on this nodeId and, if it is a write lock, saves an abort LSN. Caller will set the abortLsn later, after the write lock has been obtained.
See Also:   Locker.lockInternal



markDeleteAtTxnEnd
public void markDeleteAtTxnEnd(DatabaseImpl dbImpl, boolean deleteAtCommit) throws DatabaseException(Code)

Parameters:
  dbImpl - databaseImpl to remove
Parameters:
  deleteAtCommit - true if this databaseImpl should be cleaned oncommit, false if it should be cleaned on abort.
Parameters:
  mb - environment memory budget.



moveWriteToReadLock
void moveWriteToReadLock(long nodeId, Lock lock)(Code)
A lock is being demoted. Move it from the write collection into the read collection.



newNonTxnLocker
public Locker newNonTxnLocker() throws DatabaseException(Code)
Returns 'this', since this locker holds no non-transactional locks.



operationEnd
public void operationEnd() throws DatabaseException(Code)
Created transactions do nothing at the end of the operation.



operationEnd
public void operationEnd(boolean operationOK) throws DatabaseException(Code)
Created transactions do nothing at the end of the operation.



prepare
public int prepare(Xid xid) throws DatabaseException(Code)



readFromLog
public void readFromLog(ByteBuffer logBuffer, byte entryTypeVersion)(Code)

See Also:   Loggable.readFromLog
See Also:   It's ok for FindBugs to whine about id not being synchronized.



registerCursor
public void registerCursor(CursorImpl cursor) throws DatabaseException(Code)
Cursors operating under this transaction are added to the collection.



releaseNonTxnLocks
public void releaseNonTxnLocks() throws DatabaseException(Code)
This locker holds no non-transactional locks.



removeLock
void removeLock(long nodeId) throws DatabaseException(Code)
Remove the lock from the set owned by this transaction. If specified to LockManager.release, the lock manager will call this when its releasing a lock. Usually done because the transaction doesn't need to really keep the lock, i.e for a deleted record.



setHandleLockOwner
public void setHandleLockOwner(boolean ignore, Database dbHandle, boolean dbIsClosing) throws DatabaseException(Code)
Created transactions don't transfer locks until commit.



setOnlyAbortable
public void setOnlyAbortable()(Code)
Set the state of a transaction to ONLY_ABORTABLE.



setPrepared
public void setPrepared(boolean prepared)(Code)



setSuspended
public void setSuspended(boolean suspended)(Code)



unRegisterCursor
public void unRegisterCursor(CursorImpl cursor) throws DatabaseException(Code)
Remove a cursor from the collection.



writeToLog
public void writeToLog(ByteBuffer logBuffer)(Code)

See Also:   Loggable.writeToLog



Fields inherited from com.sleepycat.je.txn.Locker
protected boolean defaultNoWait(Code)(Java Doc)
protected Map deleteInfo(Code)(Java Doc)
protected EnvironmentImpl envImpl(Code)(Java Doc)
protected Map handleLockToHandleMap(Code)(Java Doc)
protected Map handleToHandleLockMap(Code)(Java Doc)
protected long id(Code)(Java Doc)
protected LockManager lockManager(Code)(Java Doc)
protected long lockTimeOutMillis(Code)(Java Doc)
protected boolean readUncommittedDefault(Code)(Java Doc)
protected Thread thread(Code)(Java Doc)

Methods inherited from com.sleepycat.je.txn.Locker
public void addDeleteInfo(BIN bin, Key deletedKey) throws DatabaseException(Code)(Java Doc)
abstract void addLock(Long nodeId, LockType type, LockGrantType grantStatus) throws DatabaseException(Code)(Java Doc)
public void addToHandleMaps(Long handleLockId, Database databaseHandle)(Code)(Java Doc)
abstract protected void checkState(boolean ignoreCalledByAbort) throws DatabaseException(Code)(Java Doc)
abstract public LockStats collectStats(LockStats stats) throws DatabaseException(Code)(Java Doc)
abstract public boolean createdNode(long nodeId) throws DatabaseException(Code)(Java Doc)
public void demoteLock(long nodeId) throws DatabaseException(Code)(Java Doc)
public void dumpLockTable() throws DatabaseException(Code)(Java Doc)
abstract protected long generateId(TxnManager txnManager)(Code)(Java Doc)
abstract public long getAbortLsn(long nodeId) throws DatabaseException(Code)(Java Doc)
public boolean getDefaultNoWait()(Code)(Java Doc)
public long getId()(Code)(Java Doc)
public synchronized long getLockTimeout()(Code)(Java Doc)
abstract public Txn getTxnLocker()(Code)(Java Doc)
long getTxnStartMillis()(Code)(Java Doc)
public long getTxnTimeOut()(Code)(Java Doc)
Lock getWaitingFor()(Code)(Java Doc)
abstract public WriteLockInfo getWriteLockInfo(long nodeId) throws DatabaseException(Code)(Java Doc)
public boolean isHandleLockTransferrable()(Code)(Java Doc)
abstract public boolean isReadCommittedIsolation()(Code)(Java Doc)
public boolean isReadUncommittedDefault()(Code)(Java Doc)
abstract public boolean isSerializableIsolation()(Code)(Java Doc)
public boolean isTimedOut() throws DatabaseException(Code)(Java Doc)
abstract public boolean isTransactional()(Code)(Java Doc)
public LockResult lock(long nodeId, LockType lockType, boolean noWait, DatabaseImpl database) throws LockNotGrantedException, DeadlockException, DatabaseException(Code)(Java Doc)
abstract LockResult lockInternal(long nodeId, LockType lockType, boolean noWait, DatabaseImpl database) throws DeadlockException, DatabaseException(Code)(Java Doc)
abstract public void markDeleteAtTxnEnd(DatabaseImpl db, boolean deleteAtCommit) throws DatabaseException(Code)(Java Doc)
abstract void moveWriteToReadLock(long nodeId, Lock lock)(Code)(Java Doc)
abstract public Locker newNonTxnLocker() throws DatabaseException(Code)(Java Doc)
public LockResult nonBlockingLock(long nodeId, LockType lockType, DatabaseImpl database) throws DatabaseException(Code)(Java Doc)
abstract public void operationEnd() throws DatabaseException(Code)(Java Doc)
abstract public void operationEnd(boolean operationOK) throws DatabaseException(Code)(Java Doc)
public void operationEnd(OperationStatus status) throws DatabaseException(Code)(Java Doc)
abstract public void registerCursor(CursorImpl cursor) throws DatabaseException(Code)(Java Doc)
public void releaseLock(long nodeId) throws DatabaseException(Code)(Java Doc)
abstract public void releaseNonTxnLocks() throws DatabaseException(Code)(Java Doc)
abstract void removeLock(long nodeId) throws DatabaseException(Code)(Java Doc)
abstract public void setHandleLockOwner(boolean operationOK, Database dbHandle, boolean dbIsClosing) throws DatabaseException(Code)(Java Doc)
public synchronized void setLockTimeout(long timeout)(Code)(Java Doc)
void setOnlyAbortable()(Code)(Java Doc)
public synchronized void setTxnTimeout(long timeout)(Code)(Java Doc)
void setWaitingFor(Lock lock)(Code)(Java Doc)
public boolean sharesLocksWith(Locker other)(Code)(Java Doc)
public String toString()(Code)(Java Doc)
public void transferHandleLock(Database dbHandle, Locker destLocker, boolean demoteToRead) throws DatabaseException(Code)(Java Doc)
void transferHandleLockToHandle(Database dbHandle) throws DatabaseException(Code)(Java Doc)
abstract public void unRegisterCursor(CursorImpl cursor) throws DatabaseException(Code)(Java Doc)
void unregisterHandle(Database dbHandle)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.