Java Doc for TransactionTable.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » store » raw » xact » 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 » Database DBMS » db derby 10.2 » org.apache.derby.impl.store.raw.xact 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.store.raw.xact.TransactionTable

TransactionTable
public class TransactionTable implements Formatable(Code)
The transaction table is used by the transaction factory to keep track of all transactions that are in the system.
The transction table serves the following purposes:
  1. checkpoint - when a checkpoint log record is written out, it writes out also all transactions that have updated the database. RESOLVE: this is actually not used right now - rather, the transaction table is reconstructed during the redo phase by traversing from the undo LWM. It is a goal to use this transaction table (and traversing from the redoLWM) instead of rebuilding it to speed up recovery.
  2. Quiesce State - when a system enters the quiesce state, it needs to account for all transactions in the system, even those which are just started and are in their IDLE state.
  3. TransactionTable VTI - we need to get a snapshot of all transactions in the system for diagnostic purposes.
In order to speed up the time it takes to look up a transaction from the transaction table, each transaction must have a unique transaction Id. This means newly coined transaction must also have a transaction Id.

During recovery, there is only one real xact object doing all the recovery work, but there could be many outstanding transactions that are gleamed from the log. Each of these "recovery transactions" have its on entry into the transaction table but they all share the same Xact object.

Multithreading considerations:
TransactionTable must be MT-safe it is called upon by many threads simultaneously (except during recovery)

This class depends on Hashtable synchronization!!




Constructor Summary
public  TransactionTable()
    

Method Summary
 voidadd(Xact xact, boolean exclude)
    
public  voidaddUpdateTransaction(TransactionId tid, RawTransaction tran, int transactionStatus)
     Change a transaction to update or add an update transaction to this table.
 booleanfindAndAssumeTransaction(TransactionId id, RawTransaction tran)
     Find a transaction using the transaction id, and make the passed in transaction assume the identity and properties of that transaction.
public  ContextManagerfindTransactionContextByGlobalId(GlobalXactId global_id)
     Find a transaction in the table by Global transaction id.

This routine use to be only called during offline recovery so performance was not critical.

public  LogInstantgetFirstLogInstant()
    
public  booleangetMostRecentPreparedRecoveredXact(RawTransaction tran)
     Get the most recent recovered prepared transaction.

Get the most recently added transaction that says it is prepared during recovery the transaction table and make the passed in transaction assume its identity.

public  booleangetMostRecentRollbackFirstTransaction(RawTransaction tran)
     Get the most recently added transaction that says it needs to be rolled back first (an InternalXact) from the transaction table and make the passed in transaction assume its identity.
public  booleangetMostRecentTransactionForRollback(RawTransaction tran)
     Get the most recently non-prepared added transaction from the transaction table and make the passed in transaction assume its identity.
public  HashtablegetTableForXA()
     Return the hash table to the XA layer.

The XA code will do linear read-only operations on the hash table, write operations are only done in this module.

public  TransactionInfo[]getTransactionInfo()
    
public  intgetTypeFormatId()
     Return my format identifier.
 booleanhasActiveUpdateTransaction()
     Return true if there is no transaction actively updating the database.
public  booleanhasPreparedRecoveredXact()
     Is there a prepared transaction that are recovered durring the recovery in the transaction table.
public  booleanhasPreparedXact()
     Is there a prepared transaction in the transaction table.
public  booleanhasRollbackFirstTransaction()
     Is there an active internal transaction in the transaction table.
public  TransactionIdlargestUpdateXactId()
     Return the largest update transactionId I have seen so far.
 voidprepareTransaction(TransactionId id)
     Change transaction to prepared.
public  voidreadExternal(ObjectInput in)
    
 booleanremove(TransactionId id)
    
 voidremoveUpdateTransaction(TransactionId id)
     Change update transaction to non-update

MT - MT safe, since vector is MT-safe.

public  StringtoString()
    
public  voidwriteExternal(ObjectOutput out)
    


Constructor Detail
TransactionTable
public TransactionTable()(Code)
MT - not needed for constructor




Method Detail
add
void add(Xact xact, boolean exclude)(Code)



addUpdateTransaction
public void addUpdateTransaction(TransactionId tid, RawTransaction tran, int transactionStatus)(Code)
Change a transaction to update or add an update transaction to this table.
Parameters:
  tid - the transaction id
Parameters:
  tran - the transaction to be added
Parameters:
  transactionStatus - the transaction status that is stored in theBeginXact log record



findAndAssumeTransaction
boolean findAndAssumeTransaction(TransactionId id, RawTransaction tran)(Code)
Find a transaction using the transaction id, and make the passed in transaction assume the identity and properties of that transaction.

MT - unsafe, caller is recovery, which is single threaded.
Parameters:
  id - transaction Id
Parameters:
  tran - the transaction that was made to assume the transactionIDand all other relavent information stored in the transaction table true if transaction can be found, false otherwise




findTransactionContextByGlobalId
public ContextManager findTransactionContextByGlobalId(GlobalXactId global_id)(Code)
Find a transaction in the table by Global transaction id.

This routine use to be only called during offline recovery so performance was not critical. Since that time more calls have been made, including one in startGlobalTransaction() so a linear search may no longer be appropriate. See DERBY-828. The ContextManager of the transaction being searched for.
Parameters:
  global_id - The global transaction we are searching for.




getFirstLogInstant
public LogInstant getFirstLogInstant()(Code)
Get the least recently added (oldest) transaction the RawTransaction's first log instant

MT - safe, caller can be recovery or checkpoint




getMostRecentPreparedRecoveredXact
public boolean getMostRecentPreparedRecoveredXact(RawTransaction tran)(Code)
Get the most recent recovered prepared transaction.

Get the most recently added transaction that says it is prepared during recovery the transaction table and make the passed in transaction assume its identity.

This routine, unlike the redo and rollback getMostRecent*() routines expects a brand new transaction to be passed in. If a candidate transaction is found, then upon return the transaction table will be altered such that the old entry no longer exists, and a new entry will exist pointing to the transaction passed in. The new entry will look the same as if the prepared transaction had been created during runtime rather than recovery. Should only be used in recovery handle prepare after undo !!

MT - unsafe, caller is recovery, which is single threaded. true if a candidate transaction has been found. false if noprepared/recovery transactions found in the table.
Parameters:
  tran - Newly allocated transaction to add to link to a entry.




getMostRecentRollbackFirstTransaction
public boolean getMostRecentRollbackFirstTransaction(RawTransaction tran)(Code)
Get the most recently added transaction that says it needs to be rolled back first (an InternalXact) from the transaction table and make the passed in transaction assume its identity. Should only be used in recovery undo !! RESOLVE: (sku)I don't think even these internal transactions need to be rolled back in the reverse order, because they are physical in nature. But it won't hurt.

MT - unsafe, caller is recovery, which is single threaded.




getMostRecentTransactionForRollback
public boolean getMostRecentTransactionForRollback(RawTransaction tran)(Code)
Get the most recently non-prepared added transaction from the transaction table and make the passed in transaction assume its identity. Prepared transactions will not be undone. RESOLVE: (sku) I don't think normal user transactions needs to be rolled back in order, but it won't hurt. Should only be used in recovery undo !!

MT - unsafe, caller is recovery, which is single threaded.




getTableForXA
public Hashtable getTableForXA()(Code)
Return the hash table to the XA layer.

The XA code will do linear read-only operations on the hash table, write operations are only done in this module. It is a little ugly to export the hash table, but I wanted to move the XA specific code into the XA module, so that we could configure out the XA code if necessary.

Must be MT -safe, depends on sync hash table, and must get synchronized(hash_table) for linear searches. The ContextManager of the transaction being searched for.




getTransactionInfo
public TransactionInfo[] getTransactionInfo()(Code)
Get a printable version of the transaction table



getTypeFormatId
public int getTypeFormatId()(Code)
Return my format identifier.



hasActiveUpdateTransaction
boolean hasActiveUpdateTransaction()(Code)
Return true if there is no transaction actively updating the database. New transaction may be started or old transaction committed right afterward, the caller of this routine must have other ways to stop transactions from starting or ending.

MT - safe




hasPreparedRecoveredXact
public boolean hasPreparedRecoveredXact()(Code)
Is there a prepared transaction that are recovered durring the recovery in the transaction table.

MT - unsafe, caller is recovery, which is single threaded.




hasPreparedXact
public boolean hasPreparedXact()(Code)
Is there a prepared transaction in the transaction table.

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




hasRollbackFirstTransaction
public boolean hasRollbackFirstTransaction()(Code)
Is there an active internal transaction in the transaction table.

MT - unsafe, caller is recovery, which is single threaded.




largestUpdateXactId
public TransactionId largestUpdateXactId()(Code)
Return the largest update transactionId I have seen so far.

MT - unsafe, caller is recovery, which is single threaded.




prepareTransaction
void prepareTransaction(TransactionId id)(Code)
Change transaction to prepared.

MT - unsafe, caller is recovery, which is single threaded.
Parameters:
  id - the transaction Id




readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException(Code)

exception:
  IOException - problem reading the transaction table
exception:
  ClassNotFoundException - problem reading the transaction table



remove
boolean remove(TransactionId id)(Code)



removeUpdateTransaction
void removeUpdateTransaction(TransactionId id)(Code)
Change update transaction to non-update

MT - MT safe, since vector is MT-safe.
Parameters:
  id - the transaction Id




toString
public String toString()(Code)



writeExternal
public void writeExternal(ObjectOutput out) throws IOException(Code)

exception:
  IOException - problem reading the transaction table



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)

w__w__w__.j__av_a_2___s__.com__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.