[jboss-cvs] JBoss Messaging SVN: r7476 - in branches/clebert_temp_expirement: src/main/org/jboss/messaging/core/journal/impl and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 26 01:06:54 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-06-26 01:06:54 -0400 (Fri, 26 Jun 2009)
New Revision: 7476

Added:
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/LoaderCallback.java
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalReaderCallback.java
Removed:
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/LoadManager.java
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalReader.java
Modified:
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/TestableJournal.java
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
   branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/stress/journal/AddAndRemoveStressTest.java
   branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/stress/journal/ValidateTransactionHealthTest.java
   branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/stress/journal/remote/RemoteJournalAppender.java
   branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AlignedJournalImplTest.java
   branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/JournalImplTestUnit.java
Log:
changes

Deleted: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/LoadManager.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/LoadManager.java	2009-06-26 00:02:15 UTC (rev 7475)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/LoadManager.java	2009-06-26 05:06:54 UTC (rev 7476)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.core.journal;
-
-/**
- * 
- * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
- * 
- */
-public interface LoadManager
-{
-   void addRecord(RecordInfo info);
-
-   void deleteRecord(long id);
-
-   void updateRecord(RecordInfo info);
-
-   void addPreparedTransaction(PreparedTransactionInfo preparedTransaction);
-}

Copied: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/LoaderCallback.java (from rev 7475, branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/LoadManager.java)
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/LoaderCallback.java	                        (rev 0)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/LoaderCallback.java	2009-06-26 05:06:54 UTC (rev 7476)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.journal;
+
+/**
+ * 
+ * @author <a href="mailto:clebert.suconic at jboss.com">Clebert Suconic</a>
+ * 
+ */
+public interface LoaderCallback
+{
+   void addRecord(RecordInfo info);
+
+   void deleteRecord(long id);
+
+   void updateRecord(RecordInfo info);
+
+   void addPreparedTransaction(PreparedTransactionInfo preparedTransaction);
+}


Property changes on: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/LoaderCallback.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/TestableJournal.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/TestableJournal.java	2009-06-26 00:02:15 UTC (rev 7475)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/TestableJournal.java	2009-06-26 05:06:54 UTC (rev 7476)
@@ -63,7 +63,7 @@
    /** This method could be promoted to {@link Journal} interface when we decide to use the loadManager 
     *  instead of load(List,List)
     */
-   long load(LoadManager reloadManager) throws Exception;
+   long load(LoaderCallback reloadManager) throws Exception;
 
    void forceMoveNextFile() throws Exception;
 

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-26 00:02:15 UTC (rev 7475)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-06-26 05:06:54 UTC (rev 7476)
@@ -56,7 +56,7 @@
 import org.jboss.messaging.core.exception.MessagingException;
 import org.jboss.messaging.core.journal.EncodingSupport;
 import org.jboss.messaging.core.journal.IOCallback;
-import org.jboss.messaging.core.journal.LoadManager;
+import org.jboss.messaging.core.journal.LoaderCallback;
 import org.jboss.messaging.core.journal.PreparedTransactionInfo;
 import org.jboss.messaging.core.journal.RecordInfo;
 import org.jboss.messaging.core.journal.SequentialFile;
@@ -75,7 +75,7 @@
  * <p>WIKI Page: <a href="http://wiki.jboss.org/wiki/JBossMessaging2Journal"> http://wiki.jboss.org/wiki/JBossMessaging2Journal</a></p>
  * 
  * 
- * <p>Look at {@link JournalImpl#load(LoadManager)} for the file layout
+ * <p>Look at {@link JournalImpl#load(LoaderCallback)} for the file layout
  * 
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  * 
@@ -753,7 +753,7 @@
    }
 
    /**
-    * @see JournalImpl#load(LoadManager)
+    * @see JournalImpl#load(LoaderCallback)
     */
    public synchronized long load(final List<RecordInfo> committedRecords,
                                  final List<PreparedTransactionInfo> preparedTransactions) throws Exception
@@ -761,7 +761,7 @@
       final Set<Long> recordsToDelete = new HashSet<Long>();
       final List<RecordInfo> records = new ArrayList<RecordInfo>();
 
-      long maxID = load(new LoadManager()
+      long maxID = load(new LoaderCallback()
       {
          public void addPreparedTransaction(PreparedTransactionInfo preparedTransaction)
          {
@@ -854,6 +854,8 @@
 
       compactor.flush();
 
+      createRenameFile(dataFilesToProcess, dataFilesToProcess);
+
       compactingLock.writeLock().lock();
       try
       {
@@ -866,11 +868,72 @@
          compactingLock.writeLock().unlock();
       }
 
+      renameFiles(dataFilesToProcess, compactor.newDataFiles);
    }
 
-   class Compactor implements JournalReader
+   protected void renameFiles(List<JournalFile> files, List<JournalFile> newFiles) throws Exception
    {
+      for (JournalFile file : files)
+      {
+         reinitializeFile(file);
+      }
+      
+      for (JournalFile file : newFiles)
+      {
+         String newName = file.getFile().getFileName();
+         System.out.println("name = " + newName);
+         newName = newName.substring(0, newName.lastIndexOf(".cmp"));
+         
+         file.getFile().renameTo(newName);
+      }
+      
+   }
 
+   /**
+    * @throws Exception
+    */
+   protected SequentialFile createRenameFile(List<JournalFile> files, List<JournalFile> newFiles) throws Exception
+   {
+      SequentialFile tmpRenameFile = fileFactory.createSequentialFile("journal-rename" + ".ren", 1);
+
+      tmpRenameFile.open();
+
+      ChannelBuffer renameBuffer = ChannelBuffers.dynamicBuffer(1);
+
+      renameBuffer.writeInt(-1);
+      renameBuffer.writeInt(-1);
+
+      MessagingBuffer filesToRename = ChannelBuffers.dynamicBuffer(1);
+
+      // DataFiles first
+
+      filesToRename.writeInt(files.size());
+
+      for (JournalFile file : files)
+      {
+         filesToRename.writeUTF(file.getFile().getFileName());
+         filesToRename.writeInt(file.getFileID()); // The File ID that needs to be renamed
+      }
+
+      filesToRename.writeInt(newFiles.size());
+
+      for (JournalFile file : newFiles)
+      {
+         filesToRename.writeUTF(file.getFile().getFileName());
+      }
+
+      writeAddRecord(-1, 1, (byte)0, new ByteArrayEncoding(filesToRename.array()), SIZE_ADD_RECORD, renameBuffer);
+
+      tmpRenameFile.write(renameBuffer, true);
+
+      tmpRenameFile.close();
+
+      return tmpRenameFile;
+   }
+
+   class Compactor implements JournalReaderCallback
+   {
+
       JournalFile currentFile;
 
       SequentialFile sequentialFile;
@@ -942,18 +1005,12 @@
          sequentialFile = currentFile.getFile();
          sequentialFile.renameTo(sequentialFile.getFileName() + ".cmp");
          sequentialFile.open(1);
-         currentFile = new JournalFileImpl(sequentialFile, nextOrderingID, nextOrderingID);
-         fileID = nextOrderingID++;
-         System.out.println("Next OrderingID = " + nextOrderingID);
+         fileID = currentFile.getFileID();
+         currentFile = new JournalFileImpl(sequentialFile, fileID, nextOrderingID);
 
          channelWrapper.writeInt(fileID);
-         channelWrapper.writeInt(fileID);
+         channelWrapper.writeInt(currentFile.getOrderingID());
 
-         for (int i = 0; i < 1000; i++)
-         {
-            channelWrapper.writeByte(UnitTestCase.getSamplebyte(i));
-         }
-
       }
 
       public void addRecord(RecordInfo info) throws Exception
@@ -1207,7 +1264,7 @@
     * <p> * FileID and NumberOfElements are the transaction summary, and they will be repeated (N)umberOfFiles times </p> 
     * 
     * */
-   public synchronized long load(final LoadManager loadManager) throws Exception
+   public synchronized long load(final LoaderCallback loadManager) throws Exception
    {
       if (state != STATE_STARTED)
       {
@@ -1228,7 +1285,7 @@
 
          final AtomicBoolean hasData = new AtomicBoolean(false);
 
-         int resultLastPost = readJournalFile(file, new JournalReader()
+         int resultLastPost = readJournalFile(file, new JournalReaderCallback()
          {
 
             public void addRecord(RecordInfo info) throws Exception
@@ -1904,15 +1961,15 @@
       return jf;
    }
 
-   public int readJournalFile(JournalFile file, JournalReader reader) throws Exception
+   public int readJournalFile(JournalFile file, JournalReaderCallback reader) throws Exception
    {
-      
+
       file.getFile().open(1);
 
       ByteBuffer wholeFileBuffer = fileFactory.newBuffer((int)file.getFile().size());
 
       int bytesRead = file.getFile().read(wholeFileBuffer);
-      
+
       if (bytesRead != file.getFile().size())
       {
          throw new RuntimeException("Invalid read! The system couldn't read the entire file into memory");

Deleted: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalReader.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalReader.java	2009-06-26 00:02:15 UTC (rev 7475)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalReader.java	2009-06-26 05:06:54 UTC (rev 7476)
@@ -1,91 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-
-package org.jboss.messaging.core.journal.impl;
-
-import org.jboss.messaging.core.journal.RecordInfo;
-
-/**
- * A JournalReader
- *
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- *
- *
- */
-public interface JournalReader
-{
-   void addRecord(RecordInfo info) throws Exception;
-
-   /**
-    * @param recordInfo
-    * @throws Exception 
-    */
-   void updateRecord(RecordInfo recordInfo) throws Exception;
-
-   /**
-    * @param recordID
-    */
-   void deleteRecord(long recordID) throws Exception;
-
-   /**
-    * @param transactionID
-    * @param recordInfo
-    * @throws Exception 
-    */
-   void addRecordTX(long transactionID, RecordInfo recordInfo) throws Exception;
-
-   /**
-    * @param transactionID
-    * @param recordInfo
-    * @throws Exception 
-    */
-   void updateRecordTX(long transactionID, RecordInfo recordInfo) throws Exception;
-
-   /**
-    * @param transactionID
-    * @param recordInfo
-    */
-   void deleteRecordTX(long transactionID, RecordInfo recordInfo) throws Exception;
-
-   /**
-    * @param transactionID
-    * @param extraData
-    * @param summaryData
-    */
-   void prepareRecord(long transactionID, byte[] extraData, int numberOfRecords) throws Exception;
-
-   /**
-    * @param transactionID
-    * @param summaryData
-    */
-   void commitRecord(long transactionID, int numberOfRecords) throws Exception;
-
-   /**
-    * @param transactionID
-    */
-   void rollbackRecord(long transactionID) throws Exception;
-
-   public void markAsDataFile(JournalFile file);
-
-
-}

Copied: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalReaderCallback.java (from rev 7475, branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalReader.java)
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalReaderCallback.java	                        (rev 0)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalReaderCallback.java	2009-06-26 05:06:54 UTC (rev 7476)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.messaging.core.journal.impl;
+
+import org.jboss.messaging.core.journal.RecordInfo;
+
+/**
+ * A JournalReader
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public interface JournalReaderCallback
+{
+   void addRecord(RecordInfo info) throws Exception;
+
+   /**
+    * @param recordInfo
+    * @throws Exception 
+    */
+   void updateRecord(RecordInfo recordInfo) throws Exception;
+
+   /**
+    * @param recordID
+    */
+   void deleteRecord(long recordID) throws Exception;
+
+   /**
+    * @param transactionID
+    * @param recordInfo
+    * @throws Exception 
+    */
+   void addRecordTX(long transactionID, RecordInfo recordInfo) throws Exception;
+
+   /**
+    * @param transactionID
+    * @param recordInfo
+    * @throws Exception 
+    */
+   void updateRecordTX(long transactionID, RecordInfo recordInfo) throws Exception;
+
+   /**
+    * @param transactionID
+    * @param recordInfo
+    */
+   void deleteRecordTX(long transactionID, RecordInfo recordInfo) throws Exception;
+
+   /**
+    * @param transactionID
+    * @param extraData
+    * @param summaryData
+    */
+   void prepareRecord(long transactionID, byte[] extraData, int numberOfRecords) throws Exception;
+
+   /**
+    * @param transactionID
+    * @param summaryData
+    */
+   void commitRecord(long transactionID, int numberOfRecords) throws Exception;
+
+   /**
+    * @param transactionID
+    */
+   void rollbackRecord(long transactionID) throws Exception;
+
+   public void markAsDataFile(JournalFile file);
+
+
+}


Property changes on: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalReaderCallback.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/stress/journal/AddAndRemoveStressTest.java
===================================================================
--- branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/stress/journal/AddAndRemoveStressTest.java	2009-06-26 00:02:15 UTC (rev 7475)
+++ branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/stress/journal/AddAndRemoveStressTest.java	2009-06-26 05:06:54 UTC (rev 7476)
@@ -25,7 +25,7 @@
 import java.io.File;
 import java.util.ArrayList;
 
-import org.jboss.messaging.core.journal.LoadManager;
+import org.jboss.messaging.core.journal.LoaderCallback;
 import org.jboss.messaging.core.journal.PreparedTransactionInfo;
 import org.jboss.messaging.core.journal.RecordInfo;
 import org.jboss.messaging.core.journal.SequentialFileFactory;
@@ -44,7 +44,7 @@
 
    // Constants -----------------------------------------------------
 
-   private static final LoadManager dummyLoader = new LoadManager()
+   private static final LoaderCallback dummyLoader = new LoaderCallback()
    {
 
       public void addPreparedTransaction(final PreparedTransactionInfo preparedTransaction)

Modified: branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/stress/journal/ValidateTransactionHealthTest.java
===================================================================
--- branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/stress/journal/ValidateTransactionHealthTest.java	2009-06-26 00:02:15 UTC (rev 7475)
+++ branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/stress/journal/ValidateTransactionHealthTest.java	2009-06-26 05:06:54 UTC (rev 7476)
@@ -26,7 +26,7 @@
 import java.nio.ByteBuffer;
 
 import org.jboss.messaging.core.asyncio.impl.AsynchronousFileImpl;
-import org.jboss.messaging.core.journal.LoadManager;
+import org.jboss.messaging.core.journal.LoaderCallback;
 import org.jboss.messaging.core.journal.PreparedTransactionInfo;
 import org.jboss.messaging.core.journal.RecordInfo;
 import org.jboss.messaging.core.journal.impl.JournalImpl;
@@ -181,7 +181,7 @@
 
    // Inner classes -------------------------------------------------
 
-   class Loader implements LoadManager
+   class Loader implements LoaderCallback
    {
       int numberOfPreparedTransactions = 0;
 

Modified: branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/stress/journal/remote/RemoteJournalAppender.java
===================================================================
--- branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/stress/journal/remote/RemoteJournalAppender.java	2009-06-26 00:02:15 UTC (rev 7475)
+++ branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/stress/journal/remote/RemoteJournalAppender.java	2009-06-26 05:06:54 UTC (rev 7476)
@@ -26,7 +26,7 @@
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.journal.LoadManager;
+import org.jboss.messaging.core.journal.LoaderCallback;
 import org.jboss.messaging.core.journal.PreparedTransactionInfo;
 import org.jboss.messaging.core.journal.RecordInfo;
 import org.jboss.messaging.core.journal.SequentialFileFactory;
@@ -89,7 +89,7 @@
       final JournalImpl journal = createJournal(journalType, journalDir);
       
       journal.start();
-      journal.load(new LoadManager()
+      journal.load(new LoaderCallback()
       {
          
          public void addPreparedTransaction(

Modified: branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AlignedJournalImplTest.java
===================================================================
--- branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AlignedJournalImplTest.java	2009-06-26 00:02:15 UTC (rev 7475)
+++ branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AlignedJournalImplTest.java	2009-06-26 05:06:54 UTC (rev 7476)
@@ -31,7 +31,7 @@
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.jboss.messaging.core.journal.EncodingSupport;
-import org.jboss.messaging.core.journal.LoadManager;
+import org.jboss.messaging.core.journal.LoaderCallback;
 import org.jboss.messaging.core.journal.PreparedTransactionInfo;
 import org.jboss.messaging.core.journal.RecordInfo;
 import org.jboss.messaging.core.journal.SequentialFile;
@@ -52,7 +52,7 @@
 
    // Constants -----------------------------------------------------
 
-   private static final LoadManager dummyLoader = new LoadManager()
+   private static final LoaderCallback dummyLoader = new LoaderCallback()
    {
 
       public void addPreparedTransaction(PreparedTransactionInfo preparedTransaction)

Modified: branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/JournalImplTestUnit.java
===================================================================
--- branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/JournalImplTestUnit.java	2009-06-26 00:02:15 UTC (rev 7475)
+++ branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/JournalImplTestUnit.java	2009-06-26 05:06:54 UTC (rev 7476)
@@ -36,7 +36,7 @@
 import org.jboss.messaging.core.journal.impl.JournalFile;
 import org.jboss.messaging.core.journal.impl.JournalFileImpl;
 import org.jboss.messaging.core.journal.impl.JournalImpl;
-import org.jboss.messaging.core.journal.impl.JournalReader;
+import org.jboss.messaging.core.journal.impl.JournalReaderCallback;
 import org.jboss.messaging.core.journal.impl.NIOSequentialFile;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.tests.unit.core.journal.impl.fakes.SimpleEncoding;
@@ -3101,6 +3101,11 @@
 
    public void testSimpleCompacting() throws Exception
    {
+      String tmp = "file.jbm.cmp";
+      
+      System.out.println("index = " + tmp.lastIndexOf(".cmp"));
+      
+      System.out.println("new name = " + tmp.substring(0, tmp.lastIndexOf(".cmp")));
       setup(2, 60 * 1024, true);
 
       createJournal();
@@ -3154,13 +3159,18 @@
 
       journal.compact();
 
+      stopJournal();
+      createJournal();
+      startJournal();
+      loadAndCheck();
+
       for (String fileName : fileFactory.listFiles("cmp"))
       {
          System.out.println("File = " + fileName);
 
          SequentialFile readFile = fileFactory.createSequentialFile(fileName, 1);
 
-         ((JournalImpl)journal).readJournalFile(new JournalFileImpl(readFile, 1, 1), new JournalReader()
+         ((JournalImpl)journal).readJournalFile(new JournalFileImpl(readFile, 13, 1), new JournalReaderCallback()
          {
             public void addRecord(RecordInfo info) throws Exception
             {




More information about the jboss-cvs-commits mailing list