[hornetq-commits] JBoss hornetq SVN: r9605 - branches/Branch_2_1/src/main/org/hornetq/core/journal/impl.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Aug 27 12:17:40 EDT 2010
Author: clebert.suconic at jboss.com
Date: 2010-08-27 12:17:39 -0400 (Fri, 27 Aug 2010)
New Revision: 9605
Modified:
branches/Branch_2_1/src/main/org/hornetq/core/journal/impl/CompactJournal.java
branches/Branch_2_1/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java
Log:
cleanup
Modified: branches/Branch_2_1/src/main/org/hornetq/core/journal/impl/CompactJournal.java
===================================================================
--- branches/Branch_2_1/src/main/org/hornetq/core/journal/impl/CompactJournal.java 2010-08-27 15:57:50 UTC (rev 9604)
+++ branches/Branch_2_1/src/main/org/hornetq/core/journal/impl/CompactJournal.java 2010-08-27 16:17:39 UTC (rev 9605)
@@ -13,19 +13,9 @@
package org.hornetq.core.journal.impl;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-import java.util.List;
-
-import org.hornetq.core.journal.RecordInfo;
-import org.hornetq.core.journal.SequentialFileFactory;
-import org.hornetq.utils.Base64;
-
/**
* This is an undocumented class, that will open a journal and force compacting on it.
- * It may be used under special cases, but it shouldn't be needed under regular circunstances as the system should detect
+ * It may be used under special cases, but it shouldn't be needed under regular circumstances as the system should detect
* the need for compacting.
*
* The regular use is to configure min-compact parameters.
@@ -37,7 +27,7 @@
public class CompactJournal
{
- public static void main(String arg[])
+ public static void main(final String arg[])
{
if (arg.length != 4)
{
@@ -47,7 +37,7 @@
try
{
- compactJournal(arg[0], arg[1], arg[2], 2, Integer.parseInt(arg[3]));
+ CompactJournal.compactJournal(arg[0], arg[1], arg[2], 2, Integer.parseInt(arg[3]));
}
catch (Exception e)
{
@@ -56,22 +46,22 @@
}
- public static void compactJournal(String directory,
- String journalPrefix,
- String journalSuffix,
- int minFiles,
- int fileSize) throws Exception
+ public static void compactJournal(final String directory,
+ final String journalPrefix,
+ final String journalSuffix,
+ final int minFiles,
+ final int fileSize) throws Exception
{
NIOSequentialFileFactory nio = new NIOSequentialFileFactory(directory);
JournalImpl journal = new JournalImpl(fileSize, minFiles, 0, 0, nio, journalPrefix, journalSuffix, 1);
journal.start();
-
+
journal.loadInternalOnly();
-
+
journal.compact();
-
+
journal.stop();
}
Modified: branches/Branch_2_1/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java
===================================================================
--- branches/Branch_2_1/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java 2010-08-27 15:57:50 UTC (rev 9604)
+++ branches/Branch_2_1/src/main/org/hornetq/core/journal/impl/JournalFilesRepository.java 2010-08-27 16:17:39 UTC (rev 9605)
@@ -439,28 +439,28 @@
final boolean initFile,
final boolean tmpCompactExtension) throws Exception
{
- JournalFile nextOpenedFile = null;
+ JournalFile nextFile = null;
- nextOpenedFile = freeFiles.poll();
+ nextFile = freeFiles.poll();
- if (nextOpenedFile == null)
+ if (nextFile == null)
{
- nextOpenedFile = createFile(keepOpened, multiAIO, initFile, tmpCompactExtension);
+ nextFile = createFile(keepOpened, multiAIO, initFile, tmpCompactExtension);
}
else
{
if (tmpCompactExtension)
{
- SequentialFile sequentialFile = nextOpenedFile.getFile();
+ SequentialFile sequentialFile = nextFile.getFile();
sequentialFile.renameTo(sequentialFile.getFileName() + ".cmp");
}
if (keepOpened)
{
- openFile(nextOpenedFile, multiAIO);
+ openFile(nextFile, multiAIO);
}
}
- return nextOpenedFile;
+ return nextFile;
}
// Package protected ---------------------------------------------
More information about the hornetq-commits
mailing list