You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2011/11/26 20:09:02 UTC

svn commit: r1206545 - in /incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction: NodeTableTrans.java Transaction.java TransactionManager.java

Author: andy
Date: Sat Nov 26 19:09:00 2011
New Revision: 1206545

URL: http://svn.apache.org/viewvc?rev=1206545&view=rev
Log:
Tidy up.

Modified:
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/TransactionManager.java

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java?rev=1206545&r1=1206544&r2=1206545&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/NodeTableTrans.java Sat Nov 26 19:09:00 2011
@@ -49,19 +49,19 @@ public class NodeTableTrans implements N
     private boolean passthrough = false ;
     
     private final Index nodeIndex ;
-    private ObjectFile journal ;
+    private ObjectFile journalObjFile ;
     // Start of the journal file for this transaction.
     // Always zero currently but allows for future  
-    private long journalStartOffset ; 
+    private long journalObjFileStartOffset ; 
     private final String label ;
     private final Transaction txn ;     // Can be null (during recovery).
     
-    public NodeTableTrans(Transaction txn, String label, NodeTable sub, Index nodeIndex, ObjectFile journal)
+    public NodeTableTrans(Transaction txn, String label, NodeTable sub, Index nodeIndex, ObjectFile objFile)
     {
         this.txn = txn ;
         this.base = sub ;
         this.nodeIndex = nodeIndex ;
-        this.journal = journal ;
+        this.journalObjFile = objFile ;
         this.label = label ; 
         // Show the way tables are wired up
         //debug("NTT[%s #%s] %s", label, Integer.toHexString(hashCode()), sub) ;
@@ -155,25 +155,25 @@ public class NodeTableTrans implements N
         //long journalOffset = journal.length() ;
         //offset += journalOffset ;
         
-        journalStartOffset = journal.length() ;
-        if ( journalStartOffset != 0 )
+        journalObjFileStartOffset = journalObjFile.length() ;
+        if ( journalObjFileStartOffset != 0 )
         {
-            System.err.printf("\njournalStartOffset not zero: %d/0x%02X\n",journalStartOffset, journalStartOffset) ;
+            System.err.printf("\njournalStartOffset not zero: %d/0x%02X\n",journalObjFileStartOffset, journalObjFileStartOffset) ;
             if ( false )
             {
                 // TEMP : if you see this code active in SVN, set it to false immediately.
                 // The question is how come the journal position was non-zero in the first place. 
                 System.err.printf("journalStartOffset reset to zero") ;
-                journalStartOffset = 0 ;
-                journal.truncate(0) ;
+                journalObjFileStartOffset = 0 ;
+                journalObjFile.truncate(0) ;
             }
         }
-        offset += journalStartOffset ;
+        offset += journalObjFileStartOffset ;
         
         //debug("begin: %s %s", txn.getLabel(), label) ;
         //debug("begin: base=%s  offset=0x%X journalOffset=0x%X", base, offset, journalOffset) ;
         
-        this.nodeTableJournal = new NodeTableNative(nodeIndex, journal) ;
+        this.nodeTableJournal = new NodeTableNative(nodeIndex, journalObjFile) ;
         this.nodeTableJournal = NodeTableCache.create(nodeTableJournal, CacheSize, CacheSize) ;
         // Do not add the inline NodeTable here - don't convert it's values by the offset!  
     }
@@ -212,8 +212,8 @@ public class NodeTableTrans implements N
         System.err.println("label = "+label) ;
         System.err.println("txn = "+txn) ;
         System.err.println("offset = "+offset) ;
-        System.err.println("journalStartOffset = "+journalStartOffset) ;
-        System.err.println("journal = "+journal.getLabel()) ;
+        System.err.println("journalStartOffset = "+journalObjFileStartOffset) ;
+        System.err.println("journal = "+journalObjFile.getLabel()) ;
         
         System.err.println("nodeTableJournal >>>") ;
         Iterator<Pair<NodeId, Node>> iter = nodeTableJournal.all() ;
@@ -230,7 +230,7 @@ public class NodeTableTrans implements N
         }
         
         System.err.println("journal >>>") ;
-        Iterator<Pair<Long, ByteBuffer>> iter1 = this.journal.all() ;
+        Iterator<Pair<Long, ByteBuffer>> iter1 = this.journalObjFile.all() ;
         for ( ; iter1.hasNext() ; )
         {
             Pair<Long, ByteBuffer> p = iter1.next() ;
@@ -283,8 +283,8 @@ public class NodeTableTrans implements N
         // Reset (in case we use this again)
         nodeIndex.clear() ;
         // Fixes nodeTableJournal
-        journal.truncate(journalStartOffset) ;
-        journal.sync() ;
+        journalObjFile.truncate(journalObjFileStartOffset) ;
+        journalObjFile.sync() ;
         base.sync() ;
         offset = -99 ; // base.allocOffset().getId() ; // Wil be invalid as we may write through to the base table later.
         passthrough = true ;
@@ -305,7 +305,7 @@ public class NodeTableTrans implements N
         // Ensure the cache does not flush.
         nodeTableJournal = null ;
         // then make sure the journal file is empty.
-        journal.truncate(journalStartOffset) ;
+        journalObjFile.truncate(journalObjFileStartOffset) ;
         finish() ;
     }
     
@@ -337,9 +337,9 @@ public class NodeTableTrans implements N
     public void close()
     {
         // Closing the journal flushes it; i.e. disk IO. 
-        if ( journal != null )
-            journal.close() ;
-        journal = null ;
+        if ( journalObjFile != null )
+            journalObjFile.close() ;
+        journalObjFile = null ;
     }
 
     @Override

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java?rev=1206545&r1=1206544&r2=1206545&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/Transaction.java Sat Nov 26 19:09:00 2011
@@ -53,7 +53,7 @@ public class Transaction
     private TxnOutcome outcome ;
     
     private boolean changesPending ;
-
+    
     public Transaction(DatasetGraphTDB dsg, ReadWrite mode, long id, String label, TransactionManager txnMgr)
     {
         this.id = id ;
@@ -122,7 +122,7 @@ public class Transaction
         }
         txnMgr.notifyCommit(this) ;
     }
-    
+
     private void prepare()
     {
         state = TxnState.PREPARING ;
@@ -202,7 +202,7 @@ public class Transaction
         txnMgr.notifyClose(this) ;
     }
     
-    /** A write transaction has been processed and all chanages propageted back to the database */  
+    /** A write transaction has been processed and all chanages propagated back to the database */  
     /*package*/ void signalEnacted()
     {
         synchronized (this)

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/TransactionManager.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/TransactionManager.java?rev=1206545&r1=1206544&r2=1206545&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/TransactionManager.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/TransactionManager.java Sat Nov 26 19:09:00 2011
@@ -373,7 +373,6 @@ public class TransactionManager
     /** The stage in a commit after committing - make the changes permanent in the base data */ 
     private void enactTransaction(Transaction transaction)
     {
-        // Flush the queue first.  Happens in Transaction.commit
         // Really, really do it!
         for ( TransactionLifecycle x : transaction.components() )
         {