activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1227185 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/MessageId.java
Date Wed, 04 Jan 2012 15:16:11 GMT
Author: chirino
Date: Wed Jan  4 15:16:11 2012
New Revision: 1227185

URL: http://svn.apache.org/viewvc?rev=1227185&view=rev
Log:
Allow attaching an entryLocator and dataLocator to message ids.  These fields are for message
stores to associate store keys with messages ids when the messages
get persisted to disk.  Should allow stores to perform faster message loads since the store
may be able to bypass a key lookup.


Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/MessageId.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/MessageId.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/MessageId.java?rev=1227185&r1=1227184&r2=1227185&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/MessageId.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/command/MessageId.java
Wed Jan  4 15:16:11 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.command;
 
+import java.util.concurrent.atomic.AtomicReference;
+
 /**
  * @openwire:marshaller code="110"
  * 
@@ -31,6 +33,9 @@ public class MessageId implements DataSt
     private transient String key;
     private transient int hashCode;
 
+    private transient AtomicReference<Object> dataLocator = new AtomicReference<Object>();
+    private transient Object entryLocator;
+
     public MessageId() {
         this.producerId = new ProducerId();
     }
@@ -147,11 +152,12 @@ public class MessageId implements DataSt
         MessageId copy = new MessageId(producerId, producerSequenceId);
         copy.key = key;
         copy.brokerSequenceId = brokerSequenceId;
+        copy.dataLocator = dataLocator;
         return copy;
     }
 
     /**
-     * @param o
+     * @param
      * @return
      * @see java.lang.Comparable#compareTo(java.lang.Object)
      */
@@ -162,4 +168,28 @@ public class MessageId implements DataSt
         }
         return result;
     }
+
+    /**
+     * @return a locator which aids a message store in loading a message faster.  Only used
+     * by the message stores.
+     */
+    public Object getDataLocator() {
+        return dataLocator.get();
+    }
+
+    /**
+     * Sets a locator which aids a message store in loading a message faster.  Only used
+     * by the message stores.
+     */
+    public void setDataLocator(Object value) {
+        this.dataLocator.set(value);
+    }
+
+    public Object getEntryLocator() {
+        return entryLocator;
+    }
+
+    public void setEntryLocator(Object entryLocator) {
+        this.entryLocator = entryLocator;
+    }
 }



Mime
View raw message