From 16ebc1169710ad63d8df9ce37998de943daeec69 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Fri, 8 Jul 2011 09:54:55 -0400 Subject: [PATCH] INT-1964 added DEBUG level logging to the doPoll() method in PollingConsumer and SourcePollingChannelAdapter --- .../integration/endpoint/PollingConsumer.java | 11 +++++++++++ .../endpoint/SourcePollingChannelAdapter.java | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/PollingConsumer.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/PollingConsumer.java index ead5aac5a0..427bb6ea7b 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/PollingConsumer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/PollingConsumer.java @@ -16,6 +16,9 @@ package org.springframework.integration.endpoint; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.springframework.integration.Message; import org.springframework.integration.core.MessageHandler; import org.springframework.integration.core.PollableChannel; @@ -30,6 +33,8 @@ import org.springframework.util.Assert; */ public class PollingConsumer extends AbstractPollingEndpoint { + private final Log logger = LogFactory.getLog(this.getClass()); + private final PollableChannel inputChannel; private final MessageHandler handler; @@ -53,7 +58,13 @@ public class PollingConsumer extends AbstractPollingEndpoint { Message message = (this.receiveTimeout >= 0) ? this.inputChannel.receive(this.receiveTimeout) : this.inputChannel.receive(); + if (this.logger.isDebugEnabled()){ + this.logger.debug("Poll resulted in Message: " + message); + } if (message == null) { + if (this.logger.isDebugEnabled()){ + this.logger.debug("Received no Message during the poll, returning 'false'"); + } return false; } this.handler.handleMessage(message); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java index ac972c14e0..ef72728e6f 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java @@ -16,6 +16,9 @@ package org.springframework.integration.endpoint; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.springframework.integration.Message; import org.springframework.integration.MessageChannel; import org.springframework.integration.context.NamedComponent; @@ -33,6 +36,8 @@ import org.springframework.util.Assert; * @author Oleg Zhurakousky */ public class SourcePollingChannelAdapter extends AbstractPollingEndpoint implements TrackableComponent { + + private final Log logger = LogFactory.getLog(this.getClass()); private volatile MessageSource source; @@ -87,6 +92,9 @@ public class SourcePollingChannelAdapter extends AbstractPollingEndpoint impleme @Override protected boolean doPoll() { Message message = this.source.receive(); + if (this.logger.isDebugEnabled()){ + this.logger.debug("Poll resulted in Message: " + message); + } if (message != null) { if (this.shouldTrack) { message = MessageHistory.write(message, this); @@ -94,6 +102,9 @@ public class SourcePollingChannelAdapter extends AbstractPollingEndpoint impleme this.messagingTemplate.send(this.outputChannel, message); return true; } + if (this.logger.isDebugEnabled()){ + this.logger.debug("Received no Message during the poll, returning 'false'"); + } return false; } }