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

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

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

    https://github.com/apache/activemq-artemis/pull/2427#discussion_r233493524
  
    --- Diff: 
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
 ---
    @@ -52,6 +52,62 @@
      *  consumers */
     public class CoreMessage extends RefCountMessage implements ICoreMessage {
     
    +   private static final class CoreTypedProperties extends TypedProperties {
    +
    +      // We use properties to establish routing context on clustering.
    +      // However if the client resends the message after receiving, it 
needs to be removed
    +      private static final Predicate<SimpleString> 
INTERNAL_PROPERTY_NAMES_CLEANUP_FILTER =
    +         name -> (name.startsWith(Message.HDR_ROUTE_TO_IDS) && 
!name.equals(Message.HDR_ROUTE_TO_IDS)) ||
    +            (name.startsWith(Message.HDR_ROUTE_TO_ACK_IDS) && 
!name.equals(Message.HDR_ROUTE_TO_ACK_IDS));
    +      private static final SimpleString AMQ_PROPNAME = new 
SimpleString("_AMQ_");
    +      private boolean internalProperties;
    +
    +      CoreTypedProperties() {
    +         super();
    +         internalProperties = false;
    +      }
    +
    +      private CoreTypedProperties(TypedProperties other) {
    +         super(other);
    +         if (other instanceof CoreTypedProperties) {
    +            internalProperties = ((CoreTypedProperties) 
other).internalProperties;
    +         } else {
    +            internalProperties = other.containsProperty(name -> 
name.startsWith(AMQ_PROPNAME));
    +         }
    +      }
    +
    +      @Override
    +      protected synchronized void doPutValue(SimpleString key, 
TypedProperties.PropertyValue value) {
    +         if (!internalProperties && key.startsWith(AMQ_PROPNAME)) {
    +            internalProperties = true;
    +         }
    +         super.doPutValue(key, value);
    +      }
    +
    +      public synchronized boolean cleanupInternalProperties() {
    --- End diff --
    
    again is this really public, should this only be invokable by CoreMessage


> Optimized CoreMessage's checkProperties and cleanupInternalProperties methods
> -----------------------------------------------------------------------------
>
>                 Key: ARTEMIS-2170
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2170
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>          Components: Broker
>            Reporter: Francesco Nigro
>            Assignee: Francesco Nigro
>            Priority: Minor
>
> CoreMessage::checkProperties perform too many volatile read/write and has a 
> too big body just to handle exceptional cases, while 
> cleanupInternalProperties is called on the hot path of session send, but is 
> performing too many synchronized operations and loopup on TypedProperties.



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

Reply via email to