public synchronized void delete(MessageIdentity messageID, MessageAck ack) throws JMSException {
// lets find the cached identity as it has the sequence number
// attached to it
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;
}