[jboss-cvs] JBoss Messaging SVN: r7435 - 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:34:15 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-06-22 21:34:15 -0400 (Mon, 22 Jun 2009)
New Revision: 7435

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

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:32:12 UTC (rev 7434)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-06-23 01:34:15 UTC (rev 7435)
@@ -887,7 +887,7 @@
    public void compact() throws Exception
    {
       ConcurrentMap<Long, RecordFilesRelationship> recordsSnapshotList = null;
-      
+
       ArrayList<JournalFile> dataFilesToProcess = new ArrayList<JournalFile>(dataFiles.size());
 
       boolean previousReclaimValue = autoReclaim;
@@ -906,8 +906,8 @@
             recordsSnapshotList = recordsRelationshipMap;
 
             recordsRelationshipMap = new ConcurrentHashMap<Long, RecordFilesRelationship>();
-            
-            for (JournalFile file: dataFiles)
+
+            for (JournalFile file : dataFiles)
             {
                if (file.getPendingTransactions() == 0)
                {
@@ -932,16 +932,16 @@
       {
          autoReclaim = previousReclaimValue;
       }
-      
+
       final ConcurrentMap<Long, RecordFilesRelationship> recordsSnapshot = recordsSnapshotList;
-      
-      for (final JournalFile file: dataFilesToProcess)
+
+      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");
@@ -995,12 +995,21 @@
                   System.out.println("UpdateTX " + info.id + " to be out on compacted file");
                }
             }
-            
+
          });
       }
-      
-      
 
+      writeLockCompact.lock();
+      try
+      {
+         // Restore relationshipMap
+         // Deal with updates and deletes that happened during the compacting
+      }
+      finally
+      {
+         writeLockCompact.unlock();
+      }
+
    }
 
    private boolean isInvalidSize(int bufferPos, int size)




More information about the jboss-cvs-commits mailing list