activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARTEMIS-1616) OpenWire improvements
Date Thu, 18 Jan 2018 07:03:00 GMT

    [ https://issues.apache.org/jira/browse/ARTEMIS-1616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16330160#comment-16330160
] 

ASF GitHub Bot commented on ARTEMIS-1616:
-----------------------------------------

Github user michaelandrepearce commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1786#discussion_r162262393
  
    --- Diff: artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java
---
    @@ -361,13 +371,68 @@ public int hashCode() {
           }
        }
     
    +   private static SimpleString[] splitWithCachedString(final SimpleString simpleString,
final int delim) {
    +      final String str = simpleString.str;
    +      final byte[] data = simpleString.data;
    +      final int length = str.length();
    +      List<SimpleString> all = null;
    +      int index = 0;
    +      while (index < length) {
    +         final int delimIndex = str.indexOf(delim, index);
    +         if (delimIndex == -1) {
    +            //just need to add the last one
    +            break;
    +         } else {
    +            all = addSimpleStringPart(all, data, index, delimIndex);
    +         }
    +         index = delimIndex + 1;
    +      }
    +      if (all == null) {
    +         return new SimpleString[]{simpleString};
    +      } else {
    +         // Adding the last one
    +         all = addSimpleStringPart(all, data, index, length);
    +         // Converting it to arrays
    +         final SimpleString[] parts = new SimpleString[all.size()];
    +         return all.toArray(parts);
    +      }
    +   }
    +
    +   private static List<SimpleString> addSimpleStringPart(List<SimpleString>
all,
    +                                                         final byte[] data,
    +                                                         final int startIndex,
    +                                                         final int endIndex) {
    +      final int expectedLength = endIndex - startIndex;
    +      final SimpleString ss;
    +      if (expectedLength == 0) {
    +         ss = EMPTY;
    --- End diff --
    
    How we sure, that expectedLength 0 shouldn't equal null?


> OpenWire improvements
> ---------------------
>
>                 Key: ARTEMIS-1616
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1616
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Francesco Nigro
>            Assignee: Francesco Nigro
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message