This is an automated email from the ASF dual-hosted git repository.

quinn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new a8407f8  CAMEL-12265 - reduce logging caused by load balancer probes 
in camel-mllp
a8407f8 is described below

commit a8407f8aa67ef04395a55c9f1aaadf4a945b416d
Author: Quinn Stevenson <qu...@apache.org>
AuthorDate: Tue Feb 13 14:40:28 2018 -0700

    CAMEL-12265 - reduce logging caused by load balancer probes in camel-mllp
---
 .../camel/component/mllp/MllpTcpServerConsumer.java      |  2 +-
 .../camel/component/mllp/internal/MllpSocketBuffer.java  | 16 +++++++---------
 .../mllp/internal/TcpSocketConsumerRunnable.java         |  8 +++++---
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git 
a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java
 
b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java
index cdb56a1..7d00711 100644
--- 
a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java
+++ 
b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java
@@ -194,7 +194,7 @@ public class MllpTcpServerConsumer extends DefaultConsumer {
         TcpServerConsumerValidationRunnable client = new 
TcpServerConsumerValidationRunnable(this, clientSocket, mllpBuffer);
 
         try {
-            log.info("Validating consumer for Socket {}", clientSocket);
+            log.debug("Validating consumer for Socket {}", clientSocket);
             validationExecutor.submit(client);
         } catch (RejectedExecutionException rejectedExecutionEx) {
             log.warn("Cannot validate consumer - max validations already 
active");
diff --git 
a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/MllpSocketBuffer.java
 
b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/MllpSocketBuffer.java
index bc06786..cef5044 100644
--- 
a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/MllpSocketBuffer.java
+++ 
b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/MllpSocketBuffer.java
@@ -607,9 +607,8 @@ public class MllpSocketBuffer {
         try {
             int readCount = socketInputStream.read(buffer, availableByteCount, 
buffer.length - availableByteCount);
             if (readCount == MllpProtocolConstants.END_OF_STREAM) {
-                final String exceptionMessage = "END_OF_STREAM returned from 
SocketInputStream.read(byte[], off, len)";
-                resetSocket(socket, exceptionMessage);
-                throw new SocketException(exceptionMessage);
+                resetSocket(socket);
+                throw new SocketException("END_OF_STREAM returned from 
SocketInputStream.read(byte[], off, len)");
             }
             if (readCount > 0) {
                 for (int i = 0; (startOfBlockIndex == -1 || endOfBlockIndex == 
-1) && i < readCount; ++i) {
@@ -626,13 +625,12 @@ public class MllpSocketBuffer {
         } catch (SocketTimeoutException timeoutEx) {
             throw timeoutEx;
         } catch (SocketException socketEx) {
-            final String exceptionMessage = "SocketException encountered in 
readSocketInputStream";
-            resetSocket(socket, exceptionMessage);
-            throw new MllpSocketException(exceptionMessage, socketEx);
+            resetSocket(socket);
+            throw new MllpSocketException("SocketException encountered in 
readSocketInputStream", socketEx);
         } catch (IOException ioEx) {
             final String exceptionMessage = "IOException thrown from 
SocketInputStream.read(byte[], off, len)";
-            resetSocket(socket, exceptionMessage);
-            throw new MllpSocketException(exceptionMessage, ioEx);
+            resetSocket(socket);
+            throw new MllpSocketException("IOException thrown from 
SocketInputStream.read(byte[], off, len)", ioEx);
         } finally {
             log.trace("Exiting readSocketInputStream - size = {}", size());
         }
@@ -659,7 +657,7 @@ public class MllpSocketBuffer {
             if (logMessage != null && !logMessage.isEmpty()) {
                 log.info("{} - {} socket {}", reset ? "Resetting" : "Closing", 
logMessage, socket);
             } else {
-                log.info("{} socket {}", reset ? "Resetting" : "Closing", 
socket);
+                log.debug("{} socket {}", reset ? "Resetting" : "Closing", 
socket);
             }
 
             endpoint.updateLastConnectionTerminatedTicks();
diff --git 
a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/TcpSocketConsumerRunnable.java
 
b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/TcpSocketConsumerRunnable.java
index 3e1c44d..a8159b0 100644
--- 
a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/TcpSocketConsumerRunnable.java
+++ 
b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/TcpSocketConsumerRunnable.java
@@ -166,9 +166,11 @@ public class TcpSocketConsumerRunnable implements Runnable 
{
                     mllpBuffer.readFrom(clientSocket);
                     if (mllpBuffer.hasCompleteEnvelope()) {
                         hl7MessageBytes = mllpBuffer.toMllpPayload();
-                        log.debug("Received {} byte message {}", 
hl7MessageBytes.length, Hl7Util.convertToPrintFriendlyString(hl7MessageBytes));
+                        if (log.isDebugEnabled()) {
+                            log.debug("Received {} byte message {}", 
hl7MessageBytes.length, Hl7Util.convertToPrintFriendlyString(hl7MessageBytes));
+                        }
                         if (mllpBuffer.hasLeadingOutOfBandData()) {
-                            // TODO:  Move the convertion utilities to the 
MllpSocketBuffer to avoid a byte[] copy
+                            // TODO:  Move the conversion utilities to the 
MllpSocketBuffer to avoid a byte[] copy
                             log.warn("Ignoring leading out-of-band data: {}", 
Hl7Util.convertToPrintFriendlyString(mllpBuffer.getLeadingOutOfBandData()));
                         }
                         if (mllpBuffer.hasTrailingOutOfBandData()) {
@@ -206,7 +208,7 @@ public class TcpSocketConsumerRunnable implements Runnable {
                     if (!mllpBuffer.isEmpty()) {
                         consumer.handleMessageException("Exception encountered 
reading payload", mllpBuffer.toByteArrayAndReset(), mllpSocketEx);
                     } else {
-                        log.warn("Ignoring exception encountered checking for 
data", mllpSocketEx);
+                        log.debug("Ignoring exception encountered checking for 
data", mllpSocketEx);
                     }
                 }
             }

-- 
To stop receiving notification emails like this one, please contact
qu...@apache.org.

Reply via email to