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

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

Github user franz1981 commented on the issue:

    https://github.com/apache/activemq-artemis/pull/2012
  
    @michaelandrepearce Michael have good points on that, especially for such 
important classes.
    @cshannon I have anyway the results:
    ```
    # Running 64-bit HotSpot VM.
    # Using compressed oop with 3-bit shift.
    # Using compressed klass with 3-bit shift.
    # Objects are 8 bytes aligned.
    # Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes]
    # Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes]
    
    org.apache.activemq.artemis.core.server.impl.MessageReferenceImpl object 
internals:
     OFFSET  SIZE                                                               
 TYPE DESCRIPTION                                  VALUE
          0    12                                                               
      (object header)                              N/A
         12     4                                                               
  int Node.iterCount                               N/A
         16     4   
org.apache.activemq.artemis.utils.collections.LinkedListImpl.Node Node.next     
                               N/A
         20     4   
org.apache.activemq.artemis.utils.collections.LinkedListImpl.Node Node.prev     
                               N/A
         24     8                                                               
 long MessageReferenceImpl.scheduledDeliveryTime   N/A
         32     8                                                               
 long MessageReferenceImpl.consumerID              N/A
         40     4                                                               
  int MessageReferenceImpl.deliveryCount           N/A
         44     4                                                               
  int MessageReferenceImpl.persistedCount          N/A
         48     1                                                             
boolean MessageReferenceImpl.hasConsumerID           N/A
         49     1                                                             
boolean MessageReferenceImpl.alreadyAcked            N/A
         50     2                                                               
      (alignment/padding gap)                     
         52     4                        
org.apache.activemq.artemis.api.core.Message MessageReferenceImpl.message       
          N/A
         56     4                       
org.apache.activemq.artemis.core.server.Queue MessageReferenceImpl.queue        
           N/A
         60     4                                                    
java.lang.String MessageReferenceImpl.sessionId               N/A
         64     4                                                    
java.lang.Object MessageReferenceImpl.protocolData            N/A
         68     4                                                               
      (loss due to the next object alignment)
    Instance size: 72 bytes
    Space losses: 2 bytes internal + 4 bytes external = 6 bytes total
    
    *****************************************************
    org.apache.activemq.artemis.core.paging.cursor.PagedReferenceImpl object 
internals:
     OFFSET  SIZE                                                               
 TYPE DESCRIPTION                               VALUE
          0    12                                                               
      (object header)                           N/A
         12     4                                                               
  int Node.iterCount                            N/A
         16     4   
org.apache.activemq.artemis.utils.collections.LinkedListImpl.Node Node.next     
                            N/A
         20     4   
org.apache.activemq.artemis.utils.collections.LinkedListImpl.Node Node.prev     
                            N/A
         24     8                                                               
 long PagedReferenceImpl.deliveryTime           N/A
         32     8                                                               
 long PagedReferenceImpl.consumerID             N/A
         40     8                                                               
 long PagedReferenceImpl.transactionID          N/A
         48     8                                                               
 long PagedReferenceImpl.messageID              N/A
         56     8                                                               
 long PagedReferenceImpl.messageSize            N/A
         64     4                                                               
  int PagedReferenceImpl.persistedCount         N/A
         68     4                                                               
  int PagedReferenceImpl.messageEstimate        N/A
         72     4                                                               
  int PagedReferenceImpl.deliveryCount          N/A
         76     1                                                             
boolean PagedReferenceImpl.hasConsumerID          N/A
         77     1                                                             
boolean PagedReferenceImpl.alreadyAcked           N/A
         78     1                                                               
 byte PagedReferenceImpl.largeMessage           N/A
         79     1                                                               
      (alignment/padding gap)                  
         80     4         
org.apache.activemq.artemis.core.paging.cursor.PagePosition 
PagedReferenceImpl.position               N/A
         84     4                                         
java.lang.ref.WeakReference PagedReferenceImpl.message                N/A
         88     4                                                    
java.lang.String PagedReferenceImpl.sessionId              N/A
         92     4     
org.apache.activemq.artemis.core.paging.cursor.PageSubscription 
PagedReferenceImpl.subscription           N/A
         96     4                                                    
java.lang.Object PagedReferenceImpl.protocolData           N/A
        100     4                                                               
      (loss due to the next object alignment)
    Instance size: 104 bytes
    Space losses: 1 bytes internal + 4 bytes external = 5 bytes total
    
    *****************************************************
    org.apache.activemq.artemis.core.server.impl.LastValueQueue$HolderReference 
object internals:
     OFFSET  SIZE                                                          TYPE 
DESCRIPTION                               VALUE
          0    12                                                               
(object header)                           N/A
         12     1                                                       boolean 
HolderReference.hasConsumerID             N/A
         13     3                                                               
(alignment/padding gap)                  
         16     8                                                          long 
HolderReference.consumerID                N/A
         24     4             org.apache.activemq.artemis.api.core.SimpleString 
HolderReference.prop                      N/A
         28     4      org.apache.activemq.artemis.core.server.MessageReference 
HolderReference.ref                       N/A
         32     4                                              java.lang.String 
HolderReference.sessionId                 N/A
         36     4   org.apache.activemq.artemis.core.server.impl.LastValueQueue 
HolderReference.this$0                    N/A
    Instance size: 40 bytes
    Space losses: 3 bytes internal + 0 bytes external = 3 bytes total
    ```



> MessageReference should include sessionId
> -----------------------------------------
>
>                 Key: ARTEMIS-1803
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1803
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>    Affects Versions: 2.5.0
>            Reporter: Christopher L. Shannon
>            Assignee: Christopher L. Shannon
>            Priority: Minor
>
> Right now a MessageReference will track a consumerId (in certain scenarios) 
> but the sessionId is not included.  This is a problem because consumerIds are 
> not unique and are duplicated across sessions.  In order to find a unique 
> consumer you need the sessionId and consumerId as well. 
> A use case for when this is important is when writing custom plugins.  Some 
> of the callbacks pass a message reference and it would be good to be able to 
> figure out which consumer the reference belonged to such as in the 
> messageAcknowledged callback.



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

Reply via email to