return null;
}
if (ref.getMessage().isExpired())
{
SimpleDelivery delivery = new SimpleDelivery(observer, ref, true, false);
try
{
sessionEndpoint.expireDelivery(delivery, expiryQueue);
}
catch (Throwable t)
{
log.error("Failed to expire delivery: " + delivery, t);
}
return delivery;
}
if (preserveOrdering && remote)
{
//If the header exists it means the message has already been sucked once - so reject.
if (ref.getMessage().getHeader(Message.CLUSTER_SUCKED) != null)
{
if (trace) { log.trace("Message has already been sucked once - not sucking again"); }
return null;
}
}
synchronized (startStopLock)
{
// If the consumer is stopped then we don't accept the message, it should go back into the
// queue for delivery later.
if (!started)
{
if (trace) { log.trace(this + " NOT started!"); }
return null;
}
if (trace) { log.trace(this + " has startStopLock lock, preparing the message for delivery"); }
Message message = ref.getMessage();
boolean selectorRejected = !this.accept(message);
SimpleDelivery delivery = new SimpleDelivery(observer, ref, !selectorRejected, false);
if (selectorRejected)
{
return delivery;
}
if (noLocal)
{
String conId = ((JBossMessage) message).getConnectionID();
if (trace) { log.trace("message connection id: " + conId + " current connection connection id: " + sessionEndpoint.getConnectionEndpoint().getConnectionID()); }
if (sessionEndpoint.getConnectionEndpoint().getConnectionID().equals(conId))
{
if (trace) { log.trace("Message from local connection so rejecting"); }
try
{
delivery.acknowledge(null);
}
catch (Throwable t)
{
log.error("Failed to acknowledge delivery", t);