Efficient log checks in STOMP encoder/decoder
(cherry picked from commit 122ee30)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -150,9 +150,7 @@ public class StompDecoder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (logger.isTraceEnabled()) {
|
logger.trace("Incomplete frame, resetting input buffer...");
|
||||||
logger.trace("Incomplete frame, resetting input buffer...");
|
|
||||||
}
|
|
||||||
if (headers != null && headerAccessor != null) {
|
if (headers != null && headerAccessor != null) {
|
||||||
String name = NativeMessageHeaderAccessor.NATIVE_HEADERS;
|
String name = NativeMessageHeaderAccessor.NATIVE_HEADERS;
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -288,7 +286,9 @@ public class StompDecoder {
|
|||||||
contentLength = headerAccessor.getContentLength();
|
contentLength = headerAccessor.getContentLength();
|
||||||
}
|
}
|
||||||
catch (NumberFormatException ex) {
|
catch (NumberFormatException ex) {
|
||||||
logger.warn("Ignoring invalid content-length: '" + headerAccessor);
|
if (logger.isWarnEnabled()) {
|
||||||
|
logger.warn("Ignoring invalid content-length: '" + headerAccessor);
|
||||||
|
}
|
||||||
contentLength = null;
|
contentLength = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -97,9 +97,7 @@ public class StompEncoder {
|
|||||||
DataOutputStream output = new DataOutputStream(baos);
|
DataOutputStream output = new DataOutputStream(baos);
|
||||||
|
|
||||||
if (SimpMessageType.HEARTBEAT.equals(SimpMessageHeaderAccessor.getMessageType(headers))) {
|
if (SimpMessageType.HEARTBEAT.equals(SimpMessageHeaderAccessor.getMessageType(headers))) {
|
||||||
if (logger.isTraceEnabled()) {
|
logger.trace("Encoding heartbeat");
|
||||||
logger.trace("Encoding heartbeat");
|
|
||||||
}
|
|
||||||
output.write(StompDecoder.HEARTBEAT_PAYLOAD);
|
output.write(StompDecoder.HEARTBEAT_PAYLOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user