[jboss-cvs] JBoss Messaging SVN: r7497 - 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 29 14:37:00 EDT 2009
Author: clebert.suconic at jboss.com
Date: 2009-06-29 14:36:59 -0400 (Mon, 29 Jun 2009)
New Revision: 7497
Modified:
branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalCompactor.java
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/JournalTransaction.java
Log:
just tweaks
Modified: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalCompactor.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalCompactor.java 2009-06-29 18:02:57 UTC (rev 7496)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalCompactor.java 2009-06-29 18:36:59 UTC (rev 7497)
@@ -143,27 +143,8 @@
channelWrapper = null;
}
- /**
- * @throws Exception
- */
- private void openFile() throws Exception
- {
- flush();
-
- ByteBuffer bufferWrite = fileFactory.newBuffer(journal.getFileSize());
- channelWrapper = ChannelBuffers.wrappedBuffer(bufferWrite);
-
- currentFile = journal.getFile(false, false);
- sequentialFile = currentFile.getFile();
- sequentialFile.renameTo(sequentialFile.getFileName() + ".cmp");
- sequentialFile.open(1);
- fileID = nextOrderingID++;
- currentFile = new JournalFileImpl(sequentialFile, fileID, fileID);
-
- channelWrapper.writeInt(fileID);
- channelWrapper.writeInt(fileID);
- }
-
+ // JournalReaderCallback implementation -------------------------------------------
+
public void addRecord(RecordInfo info) throws Exception
{
if (recordsSnapshot.get(info.id) != null)
@@ -362,5 +343,29 @@
}
return newTransaction;
}
+
+
+ /**
+ * @throws Exception
+ */
+ private void openFile() throws Exception
+ {
+ flush();
+ ByteBuffer bufferWrite = fileFactory.newBuffer(journal.getFileSize());
+ channelWrapper = ChannelBuffers.wrappedBuffer(bufferWrite);
+
+ currentFile = journal.getFile(false, false);
+ sequentialFile = currentFile.getFile();
+ sequentialFile.renameTo(sequentialFile.getFileName() + ".cmp");
+ sequentialFile.open(1);
+ fileID = nextOrderingID++;
+ currentFile = new JournalFileImpl(sequentialFile, fileID, fileID);
+
+ channelWrapper.writeInt(fileID);
+ channelWrapper.writeInt(fileID);
+ }
+
+
+
}
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-29 18:02:57 UTC (rev 7496)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java 2009-06-29 18:36:59 UTC (rev 7497)
@@ -2484,7 +2484,10 @@
// The callback of a transaction has to be taken inside the lock,
// when we guarantee the currentFile will not be changed,
// since we individualize the callback per file
- callback = tx.getCallback(fileFactory.isSupportsCallbacks(), currentFile);
+ if (fileFactory.isSupportsCallbacks())
+ {
+ callback = tx.getCallback(currentFile);
+ }
if (sync)
{
Modified: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalTransaction.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalTransaction.java 2009-06-29 18:02:57 UTC (rev 7496)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalTransaction.java 2009-06-29 18:36:59 UTC (rev 7497)
@@ -20,7 +20,6 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-
package org.jboss.messaging.core.journal.impl;
import java.util.ArrayList;
@@ -45,15 +44,15 @@
*/
public class JournalTransaction
{
-
- private JournalImpl journal;
-
+
+ private final JournalImpl journal;
+
private List<Pair<JournalFile, Long>> pos;
private List<Pair<JournalFile, Long>> neg;
// All the files this transaction is touching on.
- // We can't have those files being reclaimed or compacted if there is a pending transaction
+ // We can't have those files being reclaimed if there is a pending transaction
private Set<JournalFile> pendingFiles;
private TransactionCallback currentCallback;
@@ -64,12 +63,11 @@
private final AtomicInteger counter = new AtomicInteger();
-
- public JournalTransaction(JournalImpl journal)
+ public JournalTransaction(final JournalImpl journal)
{
this.journal = journal;
}
-
+
public int getCounter(final JournalFile file)
{
return internalgetCounter(file).intValue();
@@ -84,7 +82,7 @@
* @param currentFile
* @param bb
*/
- public void fillNumberOfRecords(JournalFile currentFile, MessagingBuffer bb)
+ public void fillNumberOfRecords(final JournalFile currentFile, final MessagingBuffer bb)
{
bb.writerIndex(DataConstants.SIZE_BYTE + DataConstants.SIZE_INT + DataConstants.SIZE_LONG);
@@ -94,7 +92,7 @@
/** 99.99 % of the times previous files will be already synced, since they are scheduled to be closed.
* Because of that, this operation should be almost very fast.*/
- public void syncPreviousFiles(boolean callbacks, JournalFile currentFile) throws Exception
+ public void syncPreviousFiles(final boolean callbacks, final JournalFile currentFile) throws Exception
{
if (callbacks)
{
@@ -124,36 +122,29 @@
/**
* @return
*/
- public TransactionCallback getCallback(boolean callbacks, JournalFile file) throws Exception
+ public TransactionCallback getCallback(final JournalFile file) throws Exception
{
- if (callbacks)
+ if (callbackList == null)
{
- if (callbackList == null)
- {
- callbackList = new HashMap<JournalFile, TransactionCallback>();
- }
+ callbackList = new HashMap<JournalFile, TransactionCallback>();
+ }
- currentCallback = callbackList.get(file);
+ currentCallback = callbackList.get(file);
- if (currentCallback == null)
- {
- currentCallback = new TransactionCallback();
- callbackList.put(file, currentCallback);
- }
-
- if (currentCallback.getErrorMessage() != null)
- {
- throw new MessagingException(currentCallback.getErrorCode(), currentCallback.getErrorMessage());
- }
-
- currentCallback.countUp();
-
- return currentCallback;
+ if (currentCallback == null)
+ {
+ currentCallback = new TransactionCallback();
+ callbackList.put(file, currentCallback);
}
- else
+
+ if (currentCallback.getErrorMessage() != null)
{
- return null;
+ throw new MessagingException(currentCallback.getErrorCode(), currentCallback.getErrorMessage());
}
+
+ currentCallback.countUp();
+
+ return currentCallback;
}
public void addPositive(final JournalFile file, final long id)
More information about the jboss-cvs-commits
mailing list