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.



git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1227185 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2012-01-04 15:16:11 +00:00
parent d95658f4b4
commit 1753a699e0
1 changed files with 31 additions and 1 deletions

View File

@ -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 DataStructure, Comparable<MessageId> {
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 DataStructure, Comparable<MessageId> {
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 DataStructure, Comparable<MessageId> {
}
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;
}
}