listener = _messageListener;
if (listener == null)
return false;
MessageImpl msg = null;
try {
// MessageCallback<E> callback = _messageCallback;
// XXX: not correct with new model
// _queue.listen(callback);
/*
if (msg == null)
System.out.println(_queue + " NOMESSAGE:");
*/
if (msg != null) {
if (log.isLoggable(Level.FINE)) {
log.fine(_queue + " deliver " + msg + " to listener " + listener);
}
msg.setSession(_session);
// XXX: ejb30/bb/mdb/activationconfig/queue/selectorauto/annotated/negativeTest1
if (_selector == null || _selector.isMatch(msg)) {
_session.addTransactedReceive(_queue, msg);
Thread thread = Thread.currentThread();
ClassLoader oldLoader = thread.getContextClassLoader();
try {
thread.setContextClassLoader(_listenerClassLoader);
listener.onMessage(msg);
} finally {
thread.setContextClassLoader(oldLoader);
}
}
if (_session.getTransacted())
_session.commit();
else
msg.acknowledge();
return true;
}
} catch (Exception e) {
log.log(Level.WARNING, L.l("{0}: message listener '{1}' failed for message '{2}' with exception\n{3}",