[jboss-cvs] JBoss Messaging SVN: r7434 - branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jun 22 21:32:12 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-06-22 21:32:12 -0400 (Mon, 22 Jun 2009)
New Revision: 7434

Modified:
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
Log:
Reading method

Modified: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-06-23 01:31:33 UTC (rev 7433)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-06-23 01:32:12 UTC (rev 7434)
@@ -50,7 +50,6 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
 
 import org.jboss.messaging.core.buffers.ChannelBuffer;
 import org.jboss.messaging.core.buffers.ChannelBuffers;
@@ -96,7 +95,7 @@
 
    private static final Logger log = Logger.getLogger(JournalImpl.class);
 
-   //private static final boolean trace = log.isTraceEnabled();
+   // private static final boolean trace = log.isTraceEnabled();
    private static final boolean trace = true;
 
    // This method exists just to make debug easier.
@@ -105,7 +104,7 @@
    private static final void trace(final String message)
    {
       System.out.println(message);
-      //log.trace(message);
+      // log.trace(message);
    }
 
    // The sizes of primitive types
@@ -887,7 +886,7 @@
 
    public void compact() throws Exception
    {
-      ConcurrentMap<Long, RecordFilesRelationship> recordsSnapshot = null;
+      ConcurrentMap<Long, RecordFilesRelationship> recordsSnapshotList = null;
       
       ArrayList<JournalFile> dataFilesToProcess = new ArrayList<JournalFile>(dataFiles.size());
 
@@ -904,7 +903,7 @@
          {
             autoReclaim = false;
 
-            recordsSnapshot = recordsRelationshipMap;
+            recordsSnapshotList = recordsRelationshipMap;
 
             recordsRelationshipMap = new ConcurrentHashMap<Long, RecordFilesRelationship>();
             
@@ -934,8 +933,74 @@
          autoReclaim = previousReclaimValue;
       }
       
+      final ConcurrentMap<Long, RecordFilesRelationship> recordsSnapshot = recordsSnapshotList;
       
+      for (final JournalFile file: dataFilesToProcess)
+      {
+         readJournalFile(file, new JournalReader()
+         {
+            public void addRecord(RecordInfo info) throws Exception
+            {
+               
+               if (recordsSnapshot.get(info.id) != null)
+               {
+                  System.out.println("Record " + info.id + " to be out on compacted file");
+               }
+            }
 
+            public void addRecordTX(long transactionID, RecordInfo info) throws Exception
+            {
+               if (recordsSnapshot.get(info.id) != null)
+               {
+                  System.out.println("RecordTX " + info.id + " to be out on compacted file");
+               }
+            }
+
+            public void commitRecord(long transactionID, Pair<Integer, Integer>[] summary) throws Exception
+            {
+            }
+
+            public void deleteRecord(long recordID) throws Exception
+            {
+            }
+
+            public void deleteRecordTX(long transactionID, RecordInfo recordInfo) throws Exception
+            {
+            }
+
+            public void markAsDataFile(JournalFile file)
+            {
+            }
+
+            public void prepareRecord(long transactionID, byte[] extraData, Pair<Integer, Integer>[] summary) throws Exception
+            {
+            }
+
+            public void rollbackRecord(long transactionID) throws Exception
+            {
+            }
+
+            public void updateRecord(RecordInfo info) throws Exception
+            {
+               if (recordsSnapshot.get(info.id) != null)
+               {
+                  System.out.println("Update " + info.id + " to be out on compacted file");
+               }
+            }
+
+            public void updateRecordTX(long transactionID, RecordInfo info) throws Exception
+            {
+               if (recordsSnapshot.get(info.id) != null)
+               {
+                  System.out.println("UpdateTX " + info.id + " to be out on compacted file");
+               }
+            }
+            
+         });
+      }
+      
+      
+
    }
 
    private boolean isInvalidSize(int bufferPos, int size)




More information about the jboss-cvs-commits mailing list