activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [2/2] activemq-artemis git commit: ARTEMIS-1822: Change the method name 'lookupRecord' to 'containsRecord'.
Date Fri, 27 Apr 2018 01:25:46 GMT
ARTEMIS-1822: Change the method name 'lookupRecord' to 'containsRecord'.

The method is named "lookupRecord".
"lookupRecord" seems to find a related record.
But the method is checking whether recordsSnapshot contains the id or not.
Thus, the method name "containsRecord" is more intuitive than "lookupRecord".


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/be6705af
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/be6705af
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/be6705af

Branch: refs/heads/master
Commit: be6705afac326b417a33ee135754640931cfb245
Parents: d18e843
Author: Kui LIU <brucekuiliu@gmail.com>
Authored: Tue Apr 24 18:19:24 2018 +0200
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Thu Apr 26 21:25:37 2018 -0400

----------------------------------------------------------------------
 .../artemis/core/journal/impl/AbstractJournalUpdateTask.java | 2 +-
 .../activemq/artemis/core/journal/impl/JournalCompactor.java | 8 ++++----
 .../activemq/artemis/core/journal/impl/JournalImpl.java      | 4 ++--
 .../artemis/core/journal/impl/JournalTransaction.java        | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be6705af/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
index 9d983c7..d8b5f93 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
@@ -222,7 +222,7 @@ public abstract class AbstractJournalUpdateTask implements JournalReaderCallback
       writingChannel = null;
    }
 
-   public boolean lookupRecord(final long id) {
+   public boolean containsRecord(final long id) {
       return recordsSnapshot.contains(id);
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be6705af/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java
index aab383c..be2546a 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java
@@ -221,7 +221,7 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements
Journ
       if (logger.isTraceEnabled()) {
          logger.trace("Read Record " + info);
       }
-      if (lookupRecord(info.id)) {
+      if (containsRecord(info.id)) {
          JournalInternalRecord addRecord = new JournalAddRecord(true, info.id, info.getUserRecordType(),
EncoderPersister.getInstance(), new ByteArrayEncoding(info.data));
          addRecord.setCompactCount((short) (info.compactCount + 1));
 
@@ -238,7 +238,7 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements
Journ
       if (logger.isTraceEnabled()) {
          logger.trace("Read Add Recprd TX " + transactionID + " info " + info);
       }
-      if (pendingTransactions.get(transactionID) != null || lookupRecord(info.id)) {
+      if (pendingTransactions.get(transactionID) != null || containsRecord(info.id)) {
          JournalTransaction newTransaction = getNewJournalTransaction(transactionID);
 
          JournalInternalRecord record = new JournalAddRecordTX(true, transactionID, info.id,
info.getUserRecordType(), EncoderPersister.getInstance(),new ByteArrayEncoding(info.data));
@@ -370,7 +370,7 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements
Journ
          logger.trace("onReadUpdateRecord " + info);
       }
 
-      if (lookupRecord(info.id)) {
+      if (containsRecord(info.id)) {
          JournalInternalRecord updateRecord = new JournalAddRecord(false, info.id, info.userRecordType,
EncoderPersister.getInstance(), new ByteArrayEncoding(info.data));
 
          updateRecord.setCompactCount((short) (info.compactCount + 1));
@@ -395,7 +395,7 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements
Journ
          logger.trace("onReadUpdateRecordTX " + info);
       }
 
-      if (pendingTransactions.get(transactionID) != null || lookupRecord(info.id)) {
+      if (pendingTransactions.get(transactionID) != null || containsRecord(info.id)) {
          JournalTransaction newTransaction = getNewJournalTransaction(transactionID);
 
          JournalInternalRecord updateRecordTX = new JournalAddRecordTX(false, transactionID,
info.id, info.userRecordType, EncoderPersister.getInstance(), new ByteArrayEncoding(info.data));

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be6705af/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
index 34ee72e..849dd3e 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
@@ -993,7 +993,7 @@ public class JournalImpl extends JournalBase implements TestableJournal,
Journal
    }
 
    private void checkKnownRecordID(final long id) throws Exception {
-      if (records.containsKey(id) || pendingRecords.contains(id) || (compactor != null &&
compactor.lookupRecord(id))) {
+      if (records.containsKey(id) || pendingRecords.contains(id) || (compactor != null &&
compactor.containsRecord(id))) {
          return;
       }
 
@@ -1008,7 +1008,7 @@ public class JournalImpl extends JournalBase implements TestableJournal,
Journal
 
                known.set(records.containsKey(id)
                   || pendingRecords.contains(id)
-                  || (compactor != null && compactor.lookupRecord(id)));
+                  || (compactor != null && compactor.containsRecord(id)));
             } finally {
                journalLock.readLock().unlock();
             }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/be6705af/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java
index 78887db..8f05d8d 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java
@@ -250,7 +250,7 @@ public class JournalTransaction {
             for (JournalUpdate trUpdate : pos) {
                JournalRecord posFiles = journal.getRecords().get(trUpdate.id);
 
-               if (compactor != null && compactor.lookupRecord(trUpdate.id)) {
+               if (compactor != null && compactor.containsRecord(trUpdate.id)) {
                   // This is a case where the transaction was opened after compacting was
started,
                   // but the commit arrived while compacting was working
                   // We need to cache the counter update, so compacting will take the correct
files when it is done


Mime
View raw message