activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franz1981 <...@git.apache.org>
Subject [GitHub] activemq-artemis pull request #1970: Artemis 1765 Large Mesasge fixes betwee...
Date Thu, 22 Mar 2018 17:04:15 GMT
Github user franz1981 commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1970#discussion_r176498277
  
    --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
---
    @@ -213,6 +218,63 @@ public ActiveMQBuffer getReadOnlyBodyBuffer() {
           return new ChannelBufferWrapper(buffer.slice(BODY_OFFSET, endOfBodyPosition - BUFFER_HEADER_SPACE).setIndex(0,
endOfBodyPosition - BUFFER_HEADER_SPACE).asReadOnly());
        }
     
    +   /**
    +    * This will return the proper buffer to represent the data of the Message. If compressed
it will decompress.
    +    * If large, it will read from the file or streaming.
    +    * @return
    +    * @throws ActiveMQException
    +    */
    +   @Override
    +   public ActiveMQBuffer getDataBuffer() {
    +
    +      ActiveMQBuffer buffer;
    +
    +      try {
    +         if (isLargeMessage()) {
    +            LargeBodyEncoder encoder = getBodyEncoder();
    +            encoder.open();
    +            int bodySize = (int) encoder.getLargeBodySize();
    +
    +            buffer = new ChannelBufferWrapper(UnpooledByteBufAllocator.DEFAULT.heapBuffer(bodySize));
    +
    +            encoder.encode(buffer, bodySize);
    +            encoder.close();
    +         } else {
    +            buffer = getReadOnlyBodyBuffer();
    +         }
    +
    +         if (Boolean.TRUE.equals(getBooleanProperty(Message.HDR_LARGE_COMPRESSED))) {
    +            buffer = inflate(buffer);
    +         }
    +      } catch (Exception e) {
    +         ActiveMQIOErrorException e2 = new ActiveMQIOErrorException();
    --- End diff --
    
    the exception could be packed in separate method too, because is the uncommon path


---

Mime
View raw message