AMQ-4801: Fixed chat example to not log ERROR on initial connection.

This commit is contained in:
Claus Ibsen 2013-10-14 12:17:35 +02:00
parent 98803a5949
commit 6d15c348ba
1 changed files with 9 additions and 9 deletions

View File

@ -58,16 +58,15 @@ public class AjaxListener implements MessageAvailableListener {
@Override
public synchronized void onMessageAvailable(MessageConsumer consumer) {
if (LOG.isDebugEnabled()) {
LOG.debug("message for " + consumer + " continuation=" + continuation);
}
LOG.debug("Message for consumer: {} continuation: {}", consumer, continuation);
if (continuation != null) {
try {
Message message = consumer.receive(10);
LOG.debug("message is " + message);
if (message != null) {
if (!continuation.isResumed()) {
LOG.debug("Resuming suspended continuation " + continuation);
if (!continuation.isResumed() && !continuation.isInitial()) {
LOG.debug("Resuming suspended continuation {}", continuation);
continuation.setAttribute("undelivered_message", new UndeliveredAjaxMessage(message, consumer));
continuation.resume();
} else {
@ -76,22 +75,23 @@ public class AjaxListener implements MessageAvailableListener {
}
}
} catch (Exception e) {
LOG.error("Error receiving message " + e, e);
LOG.warn("Error receiving message " + e.getMessage() + ". This exception is ignored.", e);
}
} else if (System.currentTimeMillis() - lastAccess > 2 * this.maximumReadTimeout) {
new Thread() {
@Override
public void run() {
LOG.debug("Closing consumers on client: {}", client);
client.closeConsumers();
};
}
}.start();
} else {
try {
Message message = consumer.receive(10);
bufferMessageForDelivery(message, consumer);
} catch (Exception e) {
LOG.error("Error receiving message " + e, e);
LOG.warn("Error receiving message " + e.getMessage() + ". This exception is ignored.", e);
}
}
}