* @param messageID
* @param storedIdentity
* @throws JMSException
*/
private void doDelete(MessageIdentity messageID) throws JMSException {
MessageIdentity storedIdentity=null;
synchronized( this ) {
QueueListEntry entry = deliveredMessages.getFirstEntry();
while (entry != null) {
MessageIdentity identity = (MessageIdentity) entry.getElement();
if (messageID.equals(identity)) {
deliveredMessages.remove(entry);
storedIdentity=identity;
break;
}
entry = deliveredMessages.getNextEntry(entry);
}
if (storedIdentity==null) {
// maybe the messages have not been delivered yet
// as we are recovering from a previous transaction log
entry = messagesToBeDelivered.getFirstEntry();
while (entry != null) {
MessageIdentity identity = (MessageIdentity) entry.getElement();
if (messageID.equals(identity)) {
messagesToBeDelivered.remove(entry);
storedIdentity=identity;
break;
}