activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/4] activemq-artemis git commit: ARTEMIS-1455 Fixing issues on Large Message conversion
Date Mon, 09 Oct 2017 18:32:55 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 87dab340c -> c94ca2d43


ARTEMIS-1455 Fixing issues on Large Message conversion


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

Branch: refs/heads/master
Commit: ba1323c8b28535c857c4373e4d63dcdd5cfa0a95
Parents: 484e939
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Mon Oct 9 13:36:22 2017 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Mon Oct 9 14:32:03 2017 -0400

----------------------------------------------------------------------
 .../apache/activemq/artemis/core/journal/impl/JournalImpl.java | 6 +++++-
 .../activemq/artemis/core/persistence/StorageManager.java      | 5 +++++
 .../impl/journal/AbstractJournalStorageManager.java            | 6 ++++++
 .../activemq/artemis/core/server/impl/ServerSessionImpl.java   | 2 +-
 4 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ba1323c8/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 3043b97..5f31a2b 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
@@ -2207,7 +2207,11 @@ public class JournalImpl extends JournalBase implements TestableJournal,
Journal
     */
    @Override
    public long getMaxRecordSize() {
-      return Math.min(getFileSize(), fileFactory.getBufferSize());
+      if (fileFactory.getBufferSize() == 0) {
+         return getFileSize();
+      } else {
+         return Math.min(getFileSize(), fileFactory.getBufferSize());
+      }
    }
 
    private void flushExecutor(Executor executor) throws InterruptedException {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ba1323c8/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java
index ba32252..6dc45c0 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/StorageManager.java
@@ -65,6 +65,11 @@ import org.apache.activemq.artemis.utils.IDGenerator;
  */
 public interface StorageManager extends IDGenerator, ActiveMQComponent {
 
+   default long getMaxRecordSize() {
+      /** Null journal is pretty much memory */
+      return Long.MAX_VALUE;
+   }
+
    void criticalError(Throwable error);
 
    /**

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ba1323c8/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
index 1c5a4c3..3930334 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/AbstractJournalStorageManager.java
@@ -228,6 +228,12 @@ public abstract class AbstractJournalStorageManager extends CriticalComponentImp
       idGenerator = new BatchingIDGenerator(0, CHECKPOINT_BATCH_SIZE, this);
    }
 
+
+   public long getMaxRecordSize() {
+      return messageJournal.getMaxRecordSize();
+   }
+
+
    /**
     * Called during initialization.  Used by implementations to setup Journals, Stores etc...
     *

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ba1323c8/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
index 7813341..679312c 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java
@@ -1333,7 +1333,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener
{
                                           boolean noAutoCreateQueue) throws Exception {
 
       final Message message;
-      if ((msg.getEncodeSize() > storageManager.getMessageJournal().getMaxRecordSize())
&& !msg.isLargeMessage()) {
+      if ((msg.getEncodeSize() > storageManager.getMaxRecordSize()) && !msg.isLargeMessage())
{
          message = messageToLargeMessage(msg);
       } else {
          message = msg;


Mime
View raw message