mirror of https://github.com/apache/activemq.git
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:
parent
d95658f4b4
commit
1753a699e0
|
@ -16,6 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.command;
|
package org.apache.activemq.command;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @openwire:marshaller code="110"
|
* @openwire:marshaller code="110"
|
||||||
*
|
*
|
||||||
|
@ -31,6 +33,9 @@ public class MessageId implements DataStructure, Comparable<MessageId> {
|
||||||
private transient String key;
|
private transient String key;
|
||||||
private transient int hashCode;
|
private transient int hashCode;
|
||||||
|
|
||||||
|
private transient AtomicReference<Object> dataLocator = new AtomicReference<Object>();
|
||||||
|
private transient Object entryLocator;
|
||||||
|
|
||||||
public MessageId() {
|
public MessageId() {
|
||||||
this.producerId = new ProducerId();
|
this.producerId = new ProducerId();
|
||||||
}
|
}
|
||||||
|
@ -147,11 +152,12 @@ public class MessageId implements DataStructure, Comparable<MessageId> {
|
||||||
MessageId copy = new MessageId(producerId, producerSequenceId);
|
MessageId copy = new MessageId(producerId, producerSequenceId);
|
||||||
copy.key = key;
|
copy.key = key;
|
||||||
copy.brokerSequenceId = brokerSequenceId;
|
copy.brokerSequenceId = brokerSequenceId;
|
||||||
|
copy.dataLocator = dataLocator;
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param o
|
* @param
|
||||||
* @return
|
* @return
|
||||||
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
|
@ -162,4 +168,28 @@ public class MessageId implements DataStructure, Comparable<MessageId> {
|
||||||
}
|
}
|
||||||
return result;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue