Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2014-07-15 12:49:14 -0400
committerSimone Bordet2014-07-15 12:49:14 -0400
commit745f757552698139934a6f403d9c7396cb06044a (patch)
tree92affb2e411dd4d54bc9ffd5bbf78a8643ac3af6 /jetty-websocket
parent406eba7e26b535c5729e80ce55323af72e47c5c9 (diff)
downloadorg.eclipse.jetty.project-745f757552698139934a6f403d9c7396cb06044a.tar.gz
org.eclipse.jetty.project-745f757552698139934a6f403d9c7396cb06044a.tar.xz
org.eclipse.jetty.project-745f757552698139934a6f403d9c7396cb06044a.zip
Guarded calls to LOG.debug() with if (LOG.isDebugEnabled()) to reduce allocation of varargs Object[].
Diffstat (limited to 'jetty-websocket')
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/DecoderFactory.java11
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/EncoderFactory.java11
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/MessageHandlerFactory.java26
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/AnnotatedEndpointScanner.java16
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/JsrEvents.java26
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrAnnotatedEventDriver.java46
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrEndpointEventDriver.java21
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EncoderTest.java8
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EndpointEchoClient.java8
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EndpointEchoTest.java29
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/MessageQueue.java5
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScanner_InvalidSignaturesTest.java8
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/TrackingSocket.java12
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/samples/AbstractStringEndpoint.java6
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/BasicServerEndpointConfigurator.java6
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/JsrCreator.java7
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer.java44
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java9
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/DummyConnection.java3
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/IdleTimeoutTest.java19
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScanner_InvalidSignaturesTest.java8
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/StreamTest.java12
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/TrackingSocket.java12
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/WSServer.java8
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java7
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongSocket.java4
-rw-r--r--jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java32
-rw-r--r--jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java6
-rw-r--r--jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/WebSocketClientSelectorManager.java10
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java3
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/AbstractEventDriver.java9
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedScanner.java3
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyListenerEventDriver.java3
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/ExtensionStack.java17
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java19
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/fragment/FragmentExtension.java12
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/AbstractWebSocketConnection.java33
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FrameFlusher.java6
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FutureWriteCallback.java6
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/IOState.java18
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageInputStream.java12
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageOutputStream.java8
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageWriter.java8
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventCapture.java11
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/LocalWebSocketConnection.java15
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageWriterTest.java7
-rw-r--r--jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/TrackingInputStreamSocket.java10
-rw-r--r--jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java15
-rw-r--r--jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilter.java5
-rw-r--r--jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/PathMappings.java3
50 files changed, 429 insertions, 214 deletions
diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/DecoderFactory.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/DecoderFactory.java
index c89718592c..7a74bbeee8 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/DecoderFactory.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/DecoderFactory.java
@@ -20,7 +20,6 @@ package org.eclipse.jetty.websocket.jsr356;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-
import javax.websocket.Decoder;
import javax.websocket.EndpointConfig;
@@ -99,7 +98,10 @@ public class DecoderFactory implements Configurable
public DecoderMetadata getMetadataFor(Class<?> type)
{
- LOG.debug("getMetadataFor({})",type);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("getMetadataFor({})",type);
+ }
DecoderMetadata metadata = metadatas.getMetadataByType(type);
if (metadata != null)
@@ -147,7 +149,10 @@ public class DecoderFactory implements Configurable
@Override
public void init(EndpointConfig config)
{
- LOG.debug("init({})",config);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("init({})",config);
+ }
// Instantiate all declared decoders
for (DecoderMetadata metadata : metadatas)
{
diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/EncoderFactory.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/EncoderFactory.java
index fda780b7b4..a41aa96b9f 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/EncoderFactory.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/EncoderFactory.java
@@ -20,7 +20,6 @@ package org.eclipse.jetty.websocket.jsr356;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;
@@ -92,7 +91,10 @@ public class EncoderFactory implements Configurable
public EncoderMetadata getMetadataFor(Class<?> type)
{
- LOG.debug("getMetadataFor({})",type);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("getMetadataFor({})",type);
+ }
EncoderMetadata metadata = metadatas.getMetadataByType(type);
if (metadata != null)
@@ -140,7 +142,10 @@ public class EncoderFactory implements Configurable
@Override
public void init(EndpointConfig config)
{
- LOG.debug("init({})",config);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("init({})",config);
+ }
// Instantiate all declared encoders
for (EncoderMetadata metadata : metadatas)
diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/MessageHandlerFactory.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/MessageHandlerFactory.java
index 5bf5a4685e..8ab00ea537 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/MessageHandlerFactory.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/MessageHandlerFactory.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-
import javax.websocket.MessageHandler;
import org.eclipse.jetty.util.log.Log;
@@ -46,7 +45,10 @@ public class MessageHandlerFactory
public List<MessageHandlerMetadata> getMetadata(Class<? extends MessageHandler> handler) throws IllegalStateException
{
- LOG.debug("getMetadata({})",handler);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("getMetadata({})",handler);
+ }
List<MessageHandlerMetadata> ret = registered.get(handler);
if (ret != null)
{
@@ -64,19 +66,31 @@ public class MessageHandlerFactory
if (MessageHandler.Partial.class.isAssignableFrom(handler))
{
- LOG.debug("supports Partial: {}",handler);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("supports Partial: {}",handler);
+ }
partial = true;
Class<?> onMessageClass = ReflectUtils.findGenericClassFor(handler,MessageHandler.Partial.class);
- LOG.debug("Partial message class: {}",onMessageClass);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Partial message class: {}",onMessageClass);
+ }
metadatas.add(new MessageHandlerMetadata(handler,onMessageClass,partial));
}
if (MessageHandler.Whole.class.isAssignableFrom(handler))
{
- LOG.debug("supports Whole: {}",handler.getName());
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("supports Whole: {}",handler.getName());
+ }
partial = false;
Class<?> onMessageClass = ReflectUtils.findGenericClassFor(handler,MessageHandler.Whole.class);
- LOG.debug("Whole message class: {}",onMessageClass);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Whole message class: {}",onMessageClass);
+ }
metadatas.add(new MessageHandlerMetadata(handler,onMessageClass,partial));
}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/AnnotatedEndpointScanner.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/AnnotatedEndpointScanner.java
index 655d6da92b..ac163ab42e 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/AnnotatedEndpointScanner.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/AnnotatedEndpointScanner.java
@@ -22,7 +22,6 @@ import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.List;
-
import javax.websocket.EndpointConfig;
import javax.websocket.OnClose;
import javax.websocket.OnError;
@@ -89,7 +88,10 @@ public class AnnotatedEndpointScanner<T extends Annotation, C extends EndpointCo
@Override
public void onMethodAnnotation(AnnotatedEndpointMetadata<T, C> metadata, Class<?> pojo, Method method, Annotation annotation)
{
- LOG.debug("onMethodAnnotation({}, {}, {}, {})",metadata,pojo,method,annotation);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("onMethodAnnotation({}, {}, {}, {})",metadata,pojo,method,annotation);
+ }
if (isAnnotation(annotation,OnOpen.class))
{
@@ -190,11 +192,17 @@ public class AnnotatedEndpointScanner<T extends Annotation, C extends EndpointCo
{
for (IJsrParamId paramId : paramIds)
{
- LOG.debug("{}.process()",paramId);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("{}.process()",paramId);
+ }
if (paramId.process(param,callable))
{
// Successfully identified
- LOG.debug("Identified: {}",param);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Identified: {}",param);
+ }
return true;
}
}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/JsrEvents.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/JsrEvents.java
index efdb2fc59c..725c53dff3 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/JsrEvents.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/annotations/JsrEvents.java
@@ -24,7 +24,6 @@ import java.io.Reader;
import java.lang.annotation.Annotation;
import java.nio.ByteBuffer;
import java.util.Map;
-
import javax.websocket.CloseReason;
import javax.websocket.DecodeException;
import javax.websocket.EndpointConfig;
@@ -110,7 +109,10 @@ public class JsrEvents<T extends Annotation, C extends EndpointConfig>
Object ret = onBinary.call(websocket,buf,fin);
if (ret != null)
{
- LOG.debug("returning: {}",ret);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("returning: {}",ret);
+ }
endpoint.sendObject(ret);
}
}
@@ -125,7 +127,10 @@ public class JsrEvents<T extends Annotation, C extends EndpointConfig>
Object ret = onBinaryStream.call(websocket,stream);
if (ret != null)
{
- LOG.debug("returning: {}",ret);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("returning: {}",ret);
+ }
endpoint.sendObject(ret);
}
}
@@ -167,7 +172,10 @@ public class JsrEvents<T extends Annotation, C extends EndpointConfig>
Object ret = onPong.call(websocket,pong);
if (ret != null)
{
- LOG.debug("returning: {}",ret);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("returning: {}",ret);
+ }
endpoint.sendObject(ret);
}
}
@@ -181,7 +189,10 @@ public class JsrEvents<T extends Annotation, C extends EndpointConfig>
Object ret = onText.call(websocket,text,fin);
if (ret != null)
{
- LOG.debug("returning: {}",ret);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("returning: {}",ret);
+ }
endpoint.sendObject(ret);
}
}
@@ -195,7 +206,10 @@ public class JsrEvents<T extends Annotation, C extends EndpointConfig>
Object ret = onTextStream.call(websocket,reader);
if (ret != null)
{
- LOG.debug("returning: {}",ret);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("returning: {}",ret);
+ }
endpoint.sendObject(ret);
}
}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrAnnotatedEventDriver.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrAnnotatedEventDriver.java
index 0cf9df7ab5..ed4dfd06af 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrAnnotatedEventDriver.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrAnnotatedEventDriver.java
@@ -23,7 +23,6 @@ import java.io.InputStream;
import java.io.Reader;
import java.nio.ByteBuffer;
import java.util.Map;
-
import javax.websocket.CloseReason;
import javax.websocket.DecodeException;
@@ -83,13 +82,19 @@ public class JsrAnnotatedEventDriver extends AbstractJsrEventDriver
if (events.isBinaryPartialSupported())
{
// Partial Message Support (does not use messageAppender)
- LOG.debug("Partial Binary Message: fin={}",fin);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Partial Binary Message: fin={}",fin);
+ }
activeMessage = new BinaryPartialOnMessage(this);
}
else
{
// Whole Message Support
- LOG.debug("Whole Binary Message");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Whole Binary Message");
+ }
activeMessage = new SimpleBinaryMessage(this);
}
}
@@ -101,7 +106,10 @@ public class JsrAnnotatedEventDriver extends AbstractJsrEventDriver
// Streaming Message Support
if (activeMessage == null)
{
- LOG.debug("Binary Message InputStream");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Binary Message InputStream");
+ }
final MessageInputStream stream = new MessageInputStream();
activeMessage = stream;
@@ -124,7 +132,10 @@ public class JsrAnnotatedEventDriver extends AbstractJsrEventDriver
}
}
- LOG.debug("handled = {}",handled);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("handled = {}",handled);
+ }
// Process any active MessageAppender
if (handled && (activeMessage != null))
@@ -290,13 +301,19 @@ public class JsrAnnotatedEventDriver extends AbstractJsrEventDriver
if (events.isTextPartialSupported())
{
// Partial Message Support
- LOG.debug("Partial Text Message: fin={}",fin);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Partial Text Message: fin={}",fin);
+ }
activeMessage = new TextPartialOnMessage(this);
}
else
{
// Whole Message Support
- LOG.debug("Whole Text Message");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Whole Text Message");
+ }
activeMessage = new SimpleTextMessage(this);
}
}
@@ -308,7 +325,10 @@ public class JsrAnnotatedEventDriver extends AbstractJsrEventDriver
// Streaming Message Support
if (activeMessage == null)
{
- LOG.debug("Text Message Writer");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Text Message Writer");
+ }
final MessageReader stream = new MessageReader(new MessageInputStream());
activeMessage = stream;
@@ -332,7 +352,10 @@ public class JsrAnnotatedEventDriver extends AbstractJsrEventDriver
}
}
- LOG.debug("handled = {}",handled);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("handled = {}", handled);
+ }
// Process any active MessageAppender
if (handled && (activeMessage != null))
@@ -347,7 +370,10 @@ public class JsrAnnotatedEventDriver extends AbstractJsrEventDriver
@Override
public void onTextMessage(String message)
{
- LOG.debug("onText({})",message);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("onText({})",message);
+ }
try
{
diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrEndpointEventDriver.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrEndpointEventDriver.java
index 8df798516c..1bed5196f5 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrEndpointEventDriver.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrEndpointEventDriver.java
@@ -23,7 +23,6 @@ import java.io.InputStream;
import java.io.Reader;
import java.nio.ByteBuffer;
import java.util.Map;
-
import javax.websocket.CloseReason;
import javax.websocket.Endpoint;
import javax.websocket.MessageHandler;
@@ -76,7 +75,10 @@ public class JsrEndpointEventDriver extends AbstractJsrEventDriver
final MessageHandlerWrapper wrapper = jsrsession.getMessageHandlerWrapper(MessageType.BINARY);
if (wrapper == null)
{
- LOG.debug("No BINARY MessageHandler declared");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("No BINARY MessageHandler declared");
+ }
return;
}
if (wrapper.wantsPartialMessages())
@@ -128,7 +130,10 @@ public class JsrEndpointEventDriver extends AbstractJsrEventDriver
@Override
public void onConnect()
{
- LOG.debug("onConnect({}, {})",jsrsession,config);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("onConnect({}, {})",jsrsession,config);
+ }
try
{
endpoint.onOpen(jsrsession,config);
@@ -171,7 +176,10 @@ public class JsrEndpointEventDriver extends AbstractJsrEventDriver
final MessageHandlerWrapper wrapper = jsrsession.getMessageHandlerWrapper(MessageType.TEXT);
if (wrapper == null)
{
- LOG.debug("No TEXT MessageHandler declared");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("No TEXT MessageHandler declared");
+ }
return;
}
if (wrapper.wantsPartialMessages())
@@ -232,7 +240,10 @@ public class JsrEndpointEventDriver extends AbstractJsrEventDriver
final MessageHandlerWrapper wrapper = jsrsession.getMessageHandlerWrapper(MessageType.PONG);
if (wrapper == null)
{
- LOG.debug("No PONG MessageHandler declared");
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("No PONG MessageHandler declared");
+ }
return;
}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EncoderTest.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EncoderTest.java
index 6931999e1c..f90641ffed 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EncoderTest.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EncoderTest.java
@@ -18,8 +18,6 @@
package org.eclipse.jetty.websocket.jsr356;
-import static org.hamcrest.Matchers.*;
-
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
@@ -28,7 +26,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-
import javax.websocket.ClientEndpointConfig;
import javax.websocket.ContainerProvider;
import javax.websocket.EncodeException;
@@ -52,6 +49,8 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import static org.hamcrest.Matchers.containsString;
+
public class EncoderTest
{
private static class EchoServer implements Runnable
@@ -182,7 +181,8 @@ public class EncoderTest
public void write(Quotes quotes) throws IOException, EncodeException
{
- LOG.debug("Writing Quotes: {}",quotes);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Writing Quotes: {}",quotes);
this.session.getBasicRemote().sendObject(quotes);
}
}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EndpointEchoClient.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EndpointEchoClient.java
index 958761bd1e..6d2df3201b 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EndpointEchoClient.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EndpointEchoClient.java
@@ -18,10 +18,7 @@
package org.eclipse.jetty.websocket.jsr356;
-import static org.hamcrest.Matchers.notNullValue;
-
import java.io.IOException;
-
import javax.websocket.CloseReason;
import javax.websocket.Endpoint;
import javax.websocket.EndpointConfig;
@@ -31,6 +28,8 @@ import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.junit.Assert;
+import static org.hamcrest.Matchers.notNullValue;
+
/**
* Basic Echo Client from extended Endpoint
*/
@@ -49,7 +48,8 @@ public class EndpointEchoClient extends Endpoint
@Override
public void onOpen(Session session, EndpointConfig config)
{
- LOG.debug("onOpen({}, {})",session,config);
+ if (LOG.isDebugEnabled())
+ LOG.debug("onOpen({}, {})",session,config);
this.session = session;
Assert.assertThat("Session is required",session,notNullValue());
Assert.assertThat("EndpointConfig is required",config,notNullValue());
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EndpointEchoTest.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EndpointEchoTest.java
index 858f3414bc..478e1683a8 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EndpointEchoTest.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/EndpointEchoTest.java
@@ -18,11 +18,8 @@
package org.eclipse.jetty.websocket.jsr356;
-import static org.hamcrest.Matchers.instanceOf;
-
import java.net.URI;
import java.util.concurrent.TimeUnit;
-
import javax.websocket.ContainerProvider;
import javax.websocket.Session;
import javax.websocket.WebSocketContainer;
@@ -38,6 +35,8 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import static org.hamcrest.Matchers.instanceOf;
+
public class EndpointEchoTest
{
private static final Logger LOG = Log.getLogger(EndpointEchoTest.class);
@@ -92,9 +91,11 @@ public class EndpointEchoTest
Assert.assertThat(echoer,instanceOf(javax.websocket.Endpoint.class));
// Issue connect using instance of class that extends Endpoint
Session session = container.connectToServer(echoer,serverUri);
- LOG.debug("Client Connected: {}",session);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Client Connected: {}",session);
session.getBasicRemote().sendText("Echo");
- LOG.debug("Client Message Sent");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Client Message Sent");
echoer.textCapture.messageQueue.awaitMessages(1,1000,TimeUnit.MILLISECONDS);
}
@@ -104,9 +105,11 @@ public class EndpointEchoTest
WebSocketContainer container = ContainerProvider.getWebSocketContainer();
// Issue connect using class reference (class extends Endpoint)
Session session = container.connectToServer(EndpointEchoClient.class,serverUri);
- LOG.debug("Client Connected: {}",session);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Client Connected: {}",session);
session.getBasicRemote().sendText("Echo");
- LOG.debug("Client Message Sent");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Client Message Sent");
// TODO: figure out echo verification.
// echoer.textCapture.messageQueue.awaitMessages(1,1000,TimeUnit.MILLISECONDS);
}
@@ -119,9 +122,11 @@ public class EndpointEchoTest
Assert.assertThat(echoer,instanceOf(javax.websocket.Endpoint.class));
// Issue connect using instance of class that extends abstract that extends Endpoint
Session session = container.connectToServer(echoer,serverUri);
- LOG.debug("Client Connected: {}",session);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Client Connected: {}",session);
session.getBasicRemote().sendText("Echo");
- LOG.debug("Client Message Sent");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Client Message Sent");
echoer.messageQueue.awaitMessages(1,1000,TimeUnit.MILLISECONDS);
}
@@ -131,9 +136,11 @@ public class EndpointEchoTest
WebSocketContainer container = ContainerProvider.getWebSocketContainer();
// Issue connect using class reference (class that extends abstract that extends Endpoint)
Session session = container.connectToServer(EchoStringEndpoint.class,serverUri);
- LOG.debug("Client Connected: {}",session);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Client Connected: {}",session);
session.getBasicRemote().sendText("Echo");
- LOG.debug("Client Message Sent");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Client Message Sent");
// TODO: figure out echo verification.
// echoer.messageQueue.awaitMessages(1,1000,TimeUnit.MILLISECONDS);
}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/MessageQueue.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/MessageQueue.java
index 71abd3a01f..52d8120b1c 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/MessageQueue.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/MessageQueue.java
@@ -34,7 +34,10 @@ public class MessageQueue extends BlockingArrayQueue<String>
long msDur = TimeUnit.MILLISECONDS.convert(timeoutDuration,timeoutUnit);
long now = System.currentTimeMillis();
long expireOn = now + msDur;
- LOG.debug("Await Message.. Now: {} - expireOn: {} ({} ms)",now,expireOn,msDur);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Await Message.. Now: {} - expireOn: {} ({} ms)",now,expireOn,msDur);
+ }
while (this.size() < expectedMessageCount)
{
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScanner_InvalidSignaturesTest.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScanner_InvalidSignaturesTest.java
index 8687ca5c47..b7c110264a 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScanner_InvalidSignaturesTest.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/ClientAnnotatedEndpointScanner_InvalidSignaturesTest.java
@@ -18,13 +18,10 @@
package org.eclipse.jetty.websocket.jsr356.endpoints;
-import static org.hamcrest.Matchers.containsString;
-
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-
import javax.websocket.ClientEndpoint;
import javax.websocket.ClientEndpointConfig;
import javax.websocket.DeploymentException;
@@ -51,6 +48,8 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import static org.hamcrest.Matchers.containsString;
+
/**
* Test {@link AnnotatedEndpointScanner} against various simple, 1 method, {@link ClientEndpoint} annotated classes with invalid signatures.
*/
@@ -106,7 +105,8 @@ public class ClientAnnotatedEndpointScanner_InvalidSignaturesTest
}
catch (InvalidSignatureException e)
{
- LOG.debug("{}:{}",e.getClass(),e.getMessage());
+ if (LOG.isDebugEnabled())
+ LOG.debug("{}:{}",e.getClass(),e.getMessage());
Assert.assertThat("Message",e.getMessage(),containsString(expectedAnnoClass.getSimpleName()));
}
}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/TrackingSocket.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/TrackingSocket.java
index 23a7a74b4a..a202338d17 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/TrackingSocket.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/TrackingSocket.java
@@ -18,13 +18,8 @@
package org.eclipse.jetty.websocket.jsr356.endpoints;
-import static org.hamcrest.Matchers.greaterThanOrEqualTo;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-
import javax.websocket.CloseReason;
import javax.websocket.CloseReason.CloseCode;
@@ -33,6 +28,10 @@ import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.junit.Assert;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
/**
* Abstract base socket used for tracking state and events within the socket for testing reasons.
*/
@@ -121,7 +120,8 @@ public abstract class TrackingSocket
public void waitForData(int timeoutDuration, TimeUnit timeoutUnit) throws InterruptedException
{
- LOG.debug("Waiting for message");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Waiting for message");
Assert.assertThat("Data Received",dataLatch.await(timeoutDuration,timeoutUnit),is(true));
}
}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/samples/AbstractStringEndpoint.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/samples/AbstractStringEndpoint.java
index d936da14b3..cd50fc66e3 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/samples/AbstractStringEndpoint.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/samples/AbstractStringEndpoint.java
@@ -39,7 +39,8 @@ public abstract class AbstractStringEndpoint extends Endpoint implements Message
@Override
public void onOpen(Session session, EndpointConfig config)
{
- LOG.debug("onOpen({}, {})",session,config);
+ if (LOG.isDebugEnabled())
+ LOG.debug("onOpen({}, {})",session,config);
session.addMessageHandler(this);
this.session = session;
this.config = config;
@@ -47,7 +48,8 @@ public abstract class AbstractStringEndpoint extends Endpoint implements Message
public void onClose(Session session, CloseReason closeReason)
{
- LOG.debug("onClose({}, {})",session,closeReason);
+ if (LOG.isDebugEnabled())
+ LOG.debug("onClose({}, {})",session,closeReason);
this.session = null;
}
diff --git a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/BasicServerEndpointConfigurator.java b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/BasicServerEndpointConfigurator.java
index 5d17d99802..89f4c914e7 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/BasicServerEndpointConfigurator.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/BasicServerEndpointConfigurator.java
@@ -19,7 +19,6 @@
package org.eclipse.jetty.websocket.jsr356.server;
import java.util.List;
-
import javax.websocket.Extension;
import javax.websocket.HandshakeResponse;
import javax.websocket.server.HandshakeRequest;
@@ -44,7 +43,10 @@ public class BasicServerEndpointConfigurator extends ServerEndpointConfig.Config
@Override
public <T> T getEndpointInstance(Class<T> endpointClass) throws InstantiationException
{
- LOG.debug(".getEndpointInstance({})",endpointClass);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug(".getEndpointInstance({})",endpointClass);
+ }
try
{
return endpointClass.newInstance();
diff --git a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/JsrCreator.java b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/JsrCreator.java
index 211ebbf9a5..729d0bf1df 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/JsrCreator.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/JsrCreator.java
@@ -21,7 +21,6 @@ package org.eclipse.jetty.websocket.jsr356.server;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
import javax.websocket.Extension;
import javax.websocket.Extension.Parameter;
import javax.websocket.server.ServerEndpointConfig;
@@ -73,7 +72,8 @@ public class JsrCreator implements WebSocketCreator
}
catch (IOException e)
{
- LOG.debug("Unable to send error response",e);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Unable to send error response",e);
}
return null;
}
@@ -132,7 +132,8 @@ public class JsrCreator implements WebSocketCreator
}
catch (InstantiationException e)
{
- LOG.debug("Unable to create websocket: " + config.getEndpointClass().getName(),e);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Unable to create websocket: " + config.getEndpointClass().getName(),e);
return null;
}
}
diff --git a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer.java b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer.java
index 73b01c885d..2e1f7d9462 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer.java
@@ -20,7 +20,6 @@ package org.eclipse.jetty.websocket.jsr356.server.deploy;
import java.util.HashSet;
import java.util.Set;
-
import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@@ -74,16 +73,26 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
if (TypeUtil.isFalse(enable))
{
if (c.isEmpty())
- LOG.debug("JSR-356 support disabled via attribute on context {} - {}",context.getContextPath(),context);
+ {
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("JSR-356 support disabled via attribute on context {} - {}",context.getContextPath(),context);
+ }
+ }
else
+ {
LOG.warn("JSR-356 support disabled via attribute on context {} - {}",context.getContextPath(),context);
+ }
return;
}
// Disabled if not explicitly enabled and there are no discovered annotations or interfaces
if (!TypeUtil.isTrue(enable) && c.isEmpty())
{
- LOG.debug("No JSR-356 annotations or interfaces discovered. JSR-356 support disabled",context.getContextPath(),context);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("No JSR-356 annotations or interfaces discovered. JSR-356 support disabled",context.getContextPath(),context);
+ }
return;
}
@@ -107,7 +116,10 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
// Store a reference to the ServerContainer per javax.websocket spec 1.0 final section 6.4 Programmatic Server Deployment
context.setAttribute(javax.websocket.server.ServerContainer.class.getName(),jettyContainer);
- LOG.debug("Found {} classes",c.size());
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Found {} classes",c.size());
+ }
// Now process the incoming classes
Set<Class<? extends Endpoint>> discoveredExtendedEndpoints = new HashSet<>();
@@ -116,9 +128,12 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
filterClasses(c,discoveredExtendedEndpoints,discoveredAnnotatedEndpoints,serverAppConfigs);
- LOG.debug("Discovered {} extends Endpoint classes",discoveredExtendedEndpoints.size());
- LOG.debug("Discovered {} @ServerEndpoint classes",discoveredAnnotatedEndpoints.size());
- LOG.debug("Discovered {} ServerApplicationConfig classes",serverAppConfigs.size());
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Discovered {} extends Endpoint classes",discoveredExtendedEndpoints.size());
+ LOG.debug("Discovered {} @ServerEndpoint classes",discoveredAnnotatedEndpoints.size());
+ LOG.debug("Discovered {} ServerApplicationConfig classes",serverAppConfigs.size());
+ }
// Process the server app configs to determine endpoint filtering
boolean wasFiltered = false;
@@ -127,7 +142,10 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
for (Class<? extends ServerApplicationConfig> clazz : serverAppConfigs)
{
- LOG.debug("Found ServerApplicationConfig: {}",clazz);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Found ServerApplicationConfig: {}",clazz);
+ }
try
{
ServerApplicationConfig config = clazz.newInstance();
@@ -160,8 +178,11 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
deployableExtendedEndpointConfigs = new HashSet<>();
}
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Deploying {} ServerEndpointConfig(s)",deployableExtendedEndpointConfigs.size());
+ }
// Deploy what should be deployed.
- LOG.debug("Deploying {} ServerEndpointConfig(s)",deployableExtendedEndpointConfigs.size());
for (ServerEndpointConfig config : deployableExtendedEndpointConfigs)
{
try
@@ -174,7 +195,10 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
}
}
- LOG.debug("Deploying {} @ServerEndpoint(s)",deployableAnnotatedEndpoints.size());
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Deploying {} @ServerEndpoint(s)",deployableAnnotatedEndpoints.size());
+ }
for (Class<?> annotatedClass : deployableAnnotatedEndpoints)
{
try
diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java
index 339d4776ba..2c68effda3 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ConfiguratorTest.java
@@ -18,15 +18,12 @@
package org.eclipse.jetty.websocket.jsr356.server;
-import static org.hamcrest.Matchers.*;
-
import java.net.URI;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-
import javax.websocket.Extension;
import javax.websocket.HandshakeResponse;
import javax.websocket.OnMessage;
@@ -52,6 +49,9 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.nullValue;
+
public class ConfiguratorTest
{
private static final Logger LOG = Log.getLogger(ConfiguratorTest.class);
@@ -191,7 +191,8 @@ public class ConfiguratorTest
}
int port = connector.getLocalPort();
baseServerUri = new URI(String.format("ws://%s:%d/",host,port));
- LOG.debug("Server started on {}",baseServerUri);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Server started on {}",baseServerUri);
}
@AfterClass
diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/DummyConnection.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/DummyConnection.java
index 7111ed7ef2..9db71b7124 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/DummyConnection.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/DummyConnection.java
@@ -145,7 +145,8 @@ public class DummyConnection implements LogicalConnection
@Override
public void setNextIncomingFrames(IncomingFrames incoming)
{
- LOG.debug("setNextIncomingFrames({})",incoming);
+ if (LOG.isDebugEnabled())
+ LOG.debug("setNextIncomingFrames({})",incoming);
}
@Override
diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/IdleTimeoutTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/IdleTimeoutTest.java
index db85dc06b7..1c84bc1e1f 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/IdleTimeoutTest.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/IdleTimeoutTest.java
@@ -18,9 +18,6 @@
package org.eclipse.jetty.websocket.jsr356.server;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-
import java.io.IOException;
import java.net.URI;
import java.util.Queue;
@@ -46,6 +43,10 @@ import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
public class IdleTimeoutTest
{
private static final Logger LOG = Log.getLogger(IdleTimeoutTest.class);
@@ -90,15 +91,19 @@ public class IdleTimeoutTest
{
client.start();
JettyEchoSocket clientEcho = new JettyEchoSocket();
- LOG.debug("Client Attempting to connnect");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Client Attempting to connnect");
Future<Session> future = client.connect(clientEcho,uri);
// wait for connect
future.get(1,TimeUnit.SECONDS);
- LOG.debug("Client Connected");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Client Connected");
// wait 1 second
- LOG.debug("Waiting 1 second");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Waiting 1 second");
TimeUnit.SECONDS.sleep(1);
- LOG.debug("Waited 1 second");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Waited 1 second");
if (clientEcho.getClosed() == false)
{
// Try to write
diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScanner_InvalidSignaturesTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScanner_InvalidSignaturesTest.java
index 7b3fe36f6e..75e0a73629 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScanner_InvalidSignaturesTest.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/ServerAnnotatedEndpointScanner_InvalidSignaturesTest.java
@@ -18,13 +18,10 @@
package org.eclipse.jetty.websocket.jsr356.server;
-import static org.hamcrest.Matchers.containsString;
-
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-
import javax.websocket.DeploymentException;
import javax.websocket.OnClose;
import javax.websocket.OnError;
@@ -49,6 +46,8 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import static org.hamcrest.Matchers.containsString;
+
/**
* Test {@link AnnotatedEndpointScanner} against various simple, 1 method {@link ServerEndpoint} annotated classes with invalid signatures.
*/
@@ -104,7 +103,8 @@ public class ServerAnnotatedEndpointScanner_InvalidSignaturesTest
}
catch (InvalidSignatureException e)
{
- LOG.debug("{}:{}",e.getClass(),e.getMessage());
+ if (LOG.isDebugEnabled())
+ LOG.debug("{}:{}",e.getClass(),e.getMessage());
Assert.assertThat("Message",e.getMessage(),containsString(expectedAnnoClass.getSimpleName()));
}
}
diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/StreamTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/StreamTest.java
index 2a062eaa20..dbe27e340c 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/StreamTest.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/StreamTest.java
@@ -18,8 +18,6 @@
package org.eclipse.jetty.websocket.jsr356.server;
-import static org.hamcrest.Matchers.*;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -34,7 +32,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import javax.websocket.ClientEndpoint;
import javax.websocket.CloseReason;
import javax.websocket.CloseReason.CloseCode;
@@ -71,6 +68,9 @@ import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
+import static org.hamcrest.Matchers.equalToIgnoringCase;
+import static org.hamcrest.Matchers.is;
+
public class StreamTest
{
private static final Logger LOG = Log.getLogger(StreamTest.class);
@@ -114,7 +114,8 @@ public class StreamTest
}
int port = connector.getLocalPort();
serverUri = new URI(String.format("ws://%s:%d/",host,port));
- LOG.debug("Server started on {}",serverUri);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Server started on {}",serverUri);
}
@AfterClass
@@ -290,7 +291,8 @@ public class StreamTest
if (outputFile.exists())
{
closeReason = String.format("Received %,d bytes",outputFile.length());
- LOG.debug(closeReason);
+ if (LOG.isDebugEnabled())
+ LOG.debug(closeReason);
}
else
{
diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/TrackingSocket.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/TrackingSocket.java
index da417a4e1b..18d35d9eaa 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/TrackingSocket.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/TrackingSocket.java
@@ -18,13 +18,8 @@
package org.eclipse.jetty.websocket.jsr356.server;
-import static org.hamcrest.Matchers.greaterThanOrEqualTo;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-
import javax.websocket.CloseReason;
import javax.websocket.CloseReason.CloseCode;
@@ -33,6 +28,10 @@ import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.junit.Assert;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
/**
* Abstract base socket used for tracking state and events within the socket for testing reasons.
*/
@@ -121,7 +120,8 @@ public abstract class TrackingSocket
public void waitForData(int timeoutDuration, TimeUnit timeoutUnit) throws InterruptedException
{
- LOG.debug("Waiting for message");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Waiting for message");
Assert.assertThat("Data Received",dataLatch.await(timeoutDuration,timeoutUnit),is(true));
}
}
diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/WSServer.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/WSServer.java
index 9297c7f3d2..cd636f821e 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/WSServer.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/WSServer.java
@@ -18,8 +18,6 @@
package org.eclipse.jetty.websocket.jsr356.server;
-import static org.hamcrest.Matchers.notNullValue;
-
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -49,6 +47,8 @@ import org.eclipse.jetty.webapp.WebInfConfiguration;
import org.eclipse.jetty.webapp.WebXmlConfiguration;
import org.junit.Assert;
+import static org.hamcrest.Matchers.notNullValue;
+
/**
* Utility to build out exploded directory WebApps, in the /target/tests/ directory, for testing out servers that use javax.websocket endpoints.
* <p>
@@ -178,8 +178,8 @@ public class WSServer
}
int port = connector.getLocalPort();
serverUri = new URI(String.format("ws://%s:%d%s/",host,port,contextPath));
- LOG.debug("Server started on {}",serverUri);
-
+ if (LOG.isDebugEnabled())
+ LOG.debug("Server started on {}",serverUri);
}
public void stop()
diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java
index c94f7e1e86..649300062c 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java
@@ -23,7 +23,6 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import java.util.Random;
-
import javax.websocket.CloseReason;
import javax.websocket.OnClose;
import javax.websocket.OnMessage;
@@ -206,13 +205,15 @@ public class JsrBrowserSocket
{
if (this.session == null)
{
- LOG.debug("Not connected");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Not connected");
return;
}
if (session.isOpen() == false)
{
- LOG.debug("Not open");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Not open");
return;
}
diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongSocket.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongSocket.java
index fe4981a991..26defa035e 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongSocket.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongSocket.java
@@ -19,7 +19,6 @@
package org.eclipse.jetty.websocket.jsr356.server.samples.pong;
import java.nio.charset.StandardCharsets;
-
import javax.websocket.EndpointConfig;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
@@ -48,7 +47,8 @@ public class PongSocket
@OnMessage
public void onPong(PongMessage pong)
{
- LOG.debug("onPong(): PongMessage.appData={}",BufferUtil.toDetailString(pong.getApplicationData()));
+ if (LOG.isDebugEnabled())
+ LOG.debug("onPong(): PongMessage.appData={}",BufferUtil.toDetailString(pong.getApplicationData()));
byte buf[] = BufferUtil.toArray(pong.getApplicationData());
String message = new String(buf,StandardCharsets.UTF_8);
this.session.getAsyncRemote().sendText("@OnMessage(PongMessage)[" + path + "]:" + message);
diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java
index 433f3cedd2..4a9a981620 100644
--- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java
+++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java
@@ -180,8 +180,8 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
}
}
- // Validate websocket URI
- LOG.debug("connect websocket {} to {}",websocket,toUri);
+ if (LOG.isDebugEnabled())
+ LOG.debug("connect websocket {} to {}",websocket,toUri);
// Grab Connection Manager
initialiseClient();
@@ -213,7 +213,8 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
promise.setUpgradeListener(upgradeListener);
}
- LOG.debug("Connect Promise: {}",promise);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Connect Promise: {}",promise);
// Execute the connection on the executor thread
executor.execute(promise);
@@ -225,7 +226,8 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
@Override
protected void doStart() throws Exception
{
- LOG.debug("Starting {}",this);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Starting {}",this);
if (sslContextFactory != null)
{
@@ -253,13 +255,15 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
super.doStart();
- LOG.debug("Started {}",this);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Started {}",this);
}
@Override
protected void doStop() throws Exception
{
- LOG.debug("Stopping {}",this);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Stopping {}",this);
if (cookieStore != null)
{
@@ -268,7 +272,9 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
}
super.doStop();
- LOG.debug("Stopped {}",this);
+
+ if (LOG.isDebugEnabled())
+ LOG.debug("Stopped {}",this);
}
/**
@@ -418,10 +424,12 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
continue;
}
- LOG.debug("added {}",extension);
+ if (LOG.isDebugEnabled())
+ LOG.debug("added {}",extension);
extensions.add(extension);
}
- LOG.debug("extensions={}",extensions);
+ if (LOG.isDebugEnabled())
+ LOG.debug("extensions={}",extensions);
return extensions;
}
@@ -463,14 +471,16 @@ public class WebSocketClient extends ContainerLifeCycle implements SessionListen
@Override
public void onSessionClosed(WebSocketSession session)
{
- LOG.debug("Session Closed: {}",session);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Session Closed: {}",session);
removeBean(session);
}
@Override
public void onSessionOpened(WebSocketSession session)
{
- LOG.debug("Session Opened: {}",session);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Session Opened: {}",session);
}
public void setAsyncWriteTimeout(long ms)
diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java
index fe385d3756..4fa47276eb 100644
--- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java
+++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/UpgradeConnection.java
@@ -117,11 +117,13 @@ public class UpgradeConnection extends AbstractConnection
EndPoint endPoint = getEndPoint();
// We need to gently close first, to allow
// SSL close alerts to be sent by Jetty
- LOG.debug("Shutting down output {}",endPoint);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Shutting down output {}",endPoint);
endPoint.shutdownOutput();
if (!onlyOutput)
{
- LOG.debug("Closing {}",endPoint);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Closing {}",endPoint);
endPoint.close();
}
}
diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/WebSocketClientSelectorManager.java b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/WebSocketClientSelectorManager.java
index 6616f54f99..68e2274a2a 100644
--- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/WebSocketClientSelectorManager.java
+++ b/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/io/WebSocketClientSelectorManager.java
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
import java.util.concurrent.Executor;
-
import javax.net.ssl.SSLEngine;
import org.eclipse.jetty.io.ByteBufferPool;
@@ -54,7 +53,8 @@ public class WebSocketClientSelectorManager extends SelectorManager
@Override
protected void connectionFailed(SocketChannel channel, Throwable ex, Object attachment)
{
- LOG.debug("Connection Failed",ex);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Connection Failed",ex);
ConnectPromise connect = (ConnectPromise)attachment;
connect.failed(ex);
}
@@ -67,7 +67,8 @@ public class WebSocketClientSelectorManager extends SelectorManager
@Override
public Connection newConnection(final SocketChannel channel, EndPoint endPoint, final Object attachment) throws IOException
{
- LOG.debug("newConnection({},{},{})",channel,endPoint,attachment);
+ if (LOG.isDebugEnabled())
+ LOG.debug("newConnection({},{},{})",channel,endPoint,attachment);
ConnectPromise connectPromise = (ConnectPromise)attachment;
try
@@ -114,7 +115,8 @@ public class WebSocketClientSelectorManager extends SelectorManager
@Override
protected EndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey selectionKey) throws IOException
{
- LOG.debug("newEndPoint({}, {}, {})",channel,selectSet,selectionKey);
+ if (LOG.isDebugEnabled())
+ LOG.debug("newEndPoint({}, {}, {})",channel,selectSet,selectionKey);
return new SelectChannelEndPoint(channel,selectSet,selectionKey,getScheduler(),policy.getIdleTimeout());
}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java
index 04637e392d..90da7db023 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java
@@ -352,7 +352,8 @@ public class WebSocketSession extends ContainerLifeCycle implements Session, Inc
{
try
{
- LOG.debug("{}.onSessionClosed()",listener.getClass().getSimpleName());
+ if (LOG.isDebugEnabled())
+ LOG.debug("{}.onSessionClosed()",listener.getClass().getSimpleName());
listener.onSessionClosed(this);
}
catch (Throwable t)
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/AbstractEventDriver.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/AbstractEventDriver.java
index 7a55b2db4f..e5e924f100 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/AbstractEventDriver.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/AbstractEventDriver.java
@@ -167,7 +167,8 @@ public abstract class AbstractEventDriver implements IncomingFrames, EventDriver
}
default:
{
- LOG.debug("Unhandled OpCode: {}",opcode);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Unhandled OpCode: {}",opcode);
}
}
}
@@ -211,7 +212,8 @@ public abstract class AbstractEventDriver implements IncomingFrames, EventDriver
@Override
public void openSession(WebSocketSession session)
{
- LOG.debug("openSession({})",session);
+ if (LOG.isDebugEnabled())
+ LOG.debug("openSession({})",session);
this.session = session;
try
{
@@ -226,7 +228,8 @@ public abstract class AbstractEventDriver implements IncomingFrames, EventDriver
protected void terminateConnection(int statusCode, String rawreason)
{
- LOG.debug("terminateConnection({},{})",statusCode,rawreason);
+ if (LOG.isDebugEnabled())
+ LOG.debug("terminateConnection({},{})",statusCode,rawreason);
session.close(statusCode,CloseFrame.truncate(rawreason));
}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedScanner.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedScanner.java
index 1e276e76af..6562c274bf 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedScanner.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyAnnotatedScanner.java
@@ -104,7 +104,8 @@ public class JettyAnnotatedScanner extends AbstractMethodAnnotationScanner<Jetty
@Override
public void onMethodAnnotation(JettyAnnotatedMetadata metadata, Class<?> pojo, Method method, Annotation annotation)
{
- LOG.debug("onMethodAnnotation({}, {}, {}, {})",metadata,pojo,method,annotation);
+ if (LOG.isDebugEnabled())
+ LOG.debug("onMethodAnnotation({}, {}, {}, {})",metadata,pojo,method,annotation);
if (isAnnotation(annotation,OnWebSocketConnect.class))
{
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyListenerEventDriver.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyListenerEventDriver.java
index 2a465ab751..4856c1e1dd 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyListenerEventDriver.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/JettyListenerEventDriver.java
@@ -82,7 +82,8 @@ public class JettyListenerEventDriver extends AbstractEventDriver
@Override
public void onConnect()
{
- LOG.debug("onConnect()");
+ if (LOG.isDebugEnabled())
+ LOG.debug("onConnect()");
listener.onWebSocketConnect(session);
}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/ExtensionStack.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/ExtensionStack.java
index 54198baa57..0e9ad54ea4 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/ExtensionStack.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/ExtensionStack.java
@@ -77,7 +77,6 @@ public class ExtensionStack extends ContainerLifeCycle implements IncomingFrames
protected void doStart() throws Exception
{
super.doStart();
- LOG.debug("doStart");
// Wire up Extensions
if ((extensions != null) && (extensions.size() > 0))
@@ -225,7 +224,9 @@ public class ExtensionStack extends ContainerLifeCycle implements IncomingFrames
*/
public void negotiate(List<ExtensionConfig> configs)
{
- LOG.debug("Extension Configs={}",configs);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Extension Configs={}",configs);
+
this.extensions = new ArrayList<>();
String rsvClaims[] = new String[3];
@@ -260,7 +261,8 @@ public class ExtensionStack extends ContainerLifeCycle implements IncomingFrames
extensions.add(ext);
addBean(ext);
- LOG.debug("Adding Extension: {}",config);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Adding Extension: {}",config);
// Record RSV Claims
if (ext.isRsv1User())
@@ -282,7 +284,8 @@ public class ExtensionStack extends ContainerLifeCycle implements IncomingFrames
public void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
{
FrameEntry entry = new FrameEntry(frame,callback,batchMode);
- LOG.debug("Queuing {}",entry);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Queuing {}",entry);
entries.offer(entry);
flusher.iterate();
}
@@ -377,10 +380,12 @@ public class ExtensionStack extends ContainerLifeCycle implements IncomingFrames
current = entries.poll();
if (current == null)
{
- LOG.debug("Entering IDLE");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Entering IDLE");
return Action.IDLE;
}
- LOG.debug("Processing {}",current);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Processing {}",current);
nextOutgoing.outgoingFrame(current.frame,this,current.batchMode);
return Action.SCHEDULED;
}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java
index ee6c19bcfc..ef5d6d221c 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java
@@ -135,7 +135,9 @@ public abstract class CompressExtension extends AbstractExtension
ByteAccumulator accumulator = new ByteAccumulator(maxSize);
decompressor.setInput(input, 0, input.length);
- LOG.debug("Decompressing {} bytes", input.length);
+
+ if (LOG.isDebugEnabled())
+ LOG.debug("Decompressing {} bytes", input.length);
try
{
@@ -164,7 +166,8 @@ public abstract class CompressExtension extends AbstractExtension
accumulator.addChunk(output, 0, decompressed);
}
}
- LOG.debug("Decompressed {}->{} bytes", input.length, accumulator.getLength());
+ if (LOG.isDebugEnabled())
+ LOG.debug("Decompressed {}->{} bytes", input.length, accumulator.getLength());
return accumulator;
}
catch (DataFormatException x)
@@ -187,7 +190,8 @@ public abstract class CompressExtension extends AbstractExtension
}
FrameEntry entry = new FrameEntry(frame, callback, batchMode);
- LOG.debug("Queuing {}", entry);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Queuing {}", entry);
entries.offer(entry);
flusher.iterate();
}
@@ -201,7 +205,8 @@ public abstract class CompressExtension extends AbstractExtension
}
catch (Throwable x)
{
- LOG.debug("Exception while notifying success of callback " + callback, x);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Exception while notifying success of callback " + callback, x);
}
}
@@ -214,7 +219,8 @@ public abstract class CompressExtension extends AbstractExtension
}
catch (Throwable x)
{
- LOG.debug("Exception while notifying failure of callback " + callback, x);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Exception while notifying failure of callback " + callback, x);
}
}
@@ -290,7 +296,8 @@ public abstract class CompressExtension extends AbstractExtension
ByteBuffer data = frame.getPayload();
int remaining = data.remaining();
int inputLength = Math.min(remaining, INPUT_BUFSIZE);
- LOG.debug("Compressing {}: {} bytes in {} bytes chunk", entry, remaining, inputLength);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Compressing {}: {} bytes in {} bytes chunk", entry, remaining, inputLength);
// Avoid to copy the bytes if the ByteBuffer
// is backed by an array.
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/fragment/FragmentExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/fragment/FragmentExtension.java
index c7f567f7a5..fb11f58dd4 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/fragment/FragmentExtension.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/fragment/FragmentExtension.java
@@ -69,7 +69,8 @@ public class FragmentExtension extends AbstractExtension
}
FrameEntry entry = new FrameEntry(frame, callback, batchMode);
- LOG.debug("Queuing {}", entry);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Queuing {}", entry);
entries.offer(entry);
flusher.iterate();
}
@@ -143,7 +144,8 @@ public class FragmentExtension extends AbstractExtension
ByteBuffer payloadFragment = payload.slice();
payload.limit(limit);
fragment.setPayload(payloadFragment);
- LOG.debug("Fragmented {}->{}", frame, fragment);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Fragmented {}->{}", frame, fragment);
payload.position(newLimit);
nextOutgoingFrame(fragment, this, entry.batchMode);
@@ -193,7 +195,8 @@ public class FragmentExtension extends AbstractExtension
}
catch (Throwable x)
{
- LOG.debug("Exception while notifying success of callback " + callback, x);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Exception while notifying success of callback " + callback, x);
}
}
@@ -206,7 +209,8 @@ public class FragmentExtension extends AbstractExtension
}
catch (Throwable x)
{
- LOG.debug("Exception while notifying failure of callback " + callback, x);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Exception while notifying failure of callback " + callback, x);
}
}
}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/AbstractWebSocketConnection.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/AbstractWebSocketConnection.java
index e00e339c4a..e696fd6209 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/AbstractWebSocketConnection.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/AbstractWebSocketConnection.java
@@ -78,7 +78,8 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
return;
}
- LOG.debug("Write flush failure",x);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Write flush failure",x);
ioState.onWriteFailure(x);
}
}
@@ -155,7 +156,8 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
private void onLocalClose()
{
- LOG.debug("Local Close Confirmed {}",close);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Local Close Confirmed {}",close);
if (close.isAbnormal())
{
ioState.onAbnormalClose(close);
@@ -260,7 +262,8 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
@Override
public void close(int statusCode, String reason)
{
- LOG.debug("close({},{})",statusCode,reason);
+ if (LOG.isDebugEnabled())
+ LOG.debug("close({},{})",statusCode,reason);
CloseInfo close = new CloseInfo(statusCode,reason);
this.outgoingFrame(close.asFrame(),new OnCloseLocalCallback(close),BatchMode.OFF);
}
@@ -273,13 +276,15 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
private void disconnect(boolean onlyOutput)
{
- LOG.debug("{} disconnect({})",policy.getBehavior(),onlyOutput?"outputOnly":"both");
+ if (LOG.isDebugEnabled())
+ LOG.debug("{} disconnect({})",policy.getBehavior(),onlyOutput?"outputOnly":"both");
// close FrameFlusher, we cannot write anymore at this point.
flusher.close();
EndPoint endPoint = getEndPoint();
// We need to gently close first, to allow
// SSL close alerts to be sent by Jetty
- LOG.debug("Shutting down output {}",endPoint);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Shutting down output {}",endPoint);
endPoint.shutdownOutput();
if (!onlyOutput)
{
@@ -296,7 +301,8 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
}
catch (RejectedExecutionException e)
{
- LOG.debug("Job not dispatched: {}",task);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Job not dispatched: {}",task);
}
}
@@ -401,7 +407,8 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
@Override
public void onClose()
{
- LOG.debug("{} onClose()",policy.getBehavior());
+ if (LOG.isDebugEnabled())
+ LOG.debug("{} onClose()",policy.getBehavior());
super.onClose();
// ioState.onDisconnected();
flusher.close();
@@ -410,11 +417,13 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
@Override
public void onConnectionStateChange(ConnectionState state)
{
- LOG.debug("{} Connection State Change: {}",policy.getBehavior(),state);
+ if (LOG.isDebugEnabled())
+ LOG.debug("{} Connection State Change: {}",policy.getBehavior(),state);
switch (state)
{
case OPEN:
- LOG.debug("fillInterested");
+ if (LOG.isDebugEnabled())
+ LOG.debug("fillInterested");
fillInterested();
break;
case CLOSED:
@@ -446,7 +455,8 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
@Override
public void onFillable()
{
- LOG.debug("{} onFillable()",policy.getBehavior());
+ if (LOG.isDebugEnabled())
+ LOG.debug("{} onFillable()",policy.getBehavior());
stats.countOnFillableEvents.incrementAndGet();
ByteBuffer buffer = bufferPool.acquire(getInputBufferSize(),true);
try
@@ -501,7 +511,8 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
{
IOState state = getIOState();
ConnectionState cstate = state.getConnectionState();
- LOG.debug("{} Read Timeout - {}",policy.getBehavior(),cstate);
+ if (LOG.isDebugEnabled())
+ LOG.debug("{} Read Timeout - {}",policy.getBehavior(),cstate);
if (cstate == ConnectionState.CLOSED)
{
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FrameFlusher.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FrameFlusher.java
index c375bf9bf2..da4312b57c 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FrameFlusher.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FrameFlusher.java
@@ -392,7 +392,8 @@ public class FrameFlusher
}
catch (Throwable x)
{
- LOG.debug("Exception while notifying failure of callback " + callback,x);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Exception while notifying failure of callback " + callback,x);
}
}
@@ -407,7 +408,8 @@ public class FrameFlusher
}
catch (Throwable x)
{
- LOG.debug("Exception while notifying success of callback " + callback,x);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Exception while notifying success of callback " + callback,x);
}
}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FutureWriteCallback.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FutureWriteCallback.java
index 142b9a98db..10b9d7b785 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FutureWriteCallback.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FutureWriteCallback.java
@@ -33,14 +33,16 @@ public class FutureWriteCallback extends FutureCallback implements WriteCallback
@Override
public void writeFailed(Throwable cause)
{
- LOG.debug(".writeFailed",cause);
+ if (LOG.isDebugEnabled())
+ LOG.debug(".writeFailed",cause);
failed(cause);
}
@Override
public void writeSuccess()
{
- LOG.debug(".writeSuccess");
+ if (LOG.isDebugEnabled())
+ LOG.debug(".writeSuccess");
succeeded();
}
}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/IOState.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/IOState.java
index 35c87d9178..9ae21e71f1 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/IOState.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/IOState.java
@@ -174,7 +174,8 @@ public class IOState
private void notifyStateListeners(ConnectionState state)
{
- LOG.debug("Notify State Listeners: {}",state);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Notify State Listeners: {}",state);
for (ConnectionStateListener listener : listeners)
{
if (LOG.isDebugEnabled())
@@ -192,7 +193,8 @@ public class IOState
*/
public void onAbnormalClose(CloseInfo close)
{
- LOG.debug("onAbnormalClose({})",close);
+ if (LOG.isDebugEnabled())
+ LOG.debug("onAbnormalClose({})",close);
ConnectionState event = null;
synchronized (this)
{
@@ -225,7 +227,8 @@ public class IOState
ConnectionState event = null;
ConnectionState abnormalEvent = null;
ConnectionState initialState = this.state;
- LOG.debug("onCloseLocal({}) : {}",close,initialState);
+ if (LOG.isDebugEnabled())
+ LOG.debug("onCloseLocal({}) : {}",close,initialState);
if (initialState == ConnectionState.CLOSED)
{
// already closed
@@ -239,7 +242,8 @@ public class IOState
LOG.debug("FastClose in CONNECTED detected");
// Force the state open (to allow read/write to endpoint)
onOpened();
- LOG.debug("FastClose continuing with Closure");
+ if (LOG.isDebugEnabled())
+ LOG.debug("FastClose continuing with Closure");
}
synchronized (this)
@@ -300,7 +304,8 @@ public class IOState
*/
public void onCloseRemote(CloseInfo close)
{
- LOG.debug("onCloseRemote({})",close);
+ if (LOG.isDebugEnabled())
+ LOG.debug("onCloseRemote({})",close);
ConnectionState event = null;
synchronized (this)
{
@@ -321,7 +326,8 @@ public class IOState
in = false;
inputAvailable = false;
- LOG.debug("onCloseRemote(), input={}, output={}",in,out);
+ if (LOG.isDebugEnabled())
+ LOG.debug("onCloseRemote(), input={}, output={}",in,out);
if (!in && !out)
{
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageInputStream.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageInputStream.java
index 710ae1fc57..944c931fc4 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageInputStream.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageInputStream.java
@@ -129,7 +129,8 @@ public class MessageInputStream extends InputStream implements MessageAppender
@Override
public void messageComplete()
{
- LOG.debug("Message completed");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Message completed");
buffers.offer(EOF);
}
@@ -140,7 +141,8 @@ public class MessageInputStream extends InputStream implements MessageAppender
{
if (closed.get())
{
- LOG.debug("Stream closed");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Stream closed");
return -1;
}
@@ -166,7 +168,8 @@ public class MessageInputStream extends InputStream implements MessageAppender
if (activeBuffer == EOF)
{
- LOG.debug("Reached EOF");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Reached EOF");
// Be sure that this stream cannot be reused.
closed.set(true);
// Removed buffers that may have remained in the queue.
@@ -179,7 +182,8 @@ public class MessageInputStream extends InputStream implements MessageAppender
}
catch (InterruptedException x)
{
- LOG.debug("Interrupted while waiting to read", x);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Interrupted while waiting to read", x);
closed.set(true);
return -1;
}
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageOutputStream.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageOutputStream.java
index 6da8f3e942..719273d8c4 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageOutputStream.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageOutputStream.java
@@ -30,8 +30,8 @@ import org.eclipse.jetty.websocket.api.BatchMode;
import org.eclipse.jetty.websocket.api.WriteCallback;
import org.eclipse.jetty.websocket.api.extensions.OutgoingFrames;
import org.eclipse.jetty.websocket.common.BlockingWriteCallback;
-import org.eclipse.jetty.websocket.common.WebSocketSession;
import org.eclipse.jetty.websocket.common.BlockingWriteCallback.WriteBlocker;
+import org.eclipse.jetty.websocket.common.WebSocketSession;
import org.eclipse.jetty.websocket.common.frames.BinaryFrame;
/**
@@ -117,7 +117,8 @@ public class MessageOutputStream extends OutputStream
{
flush(true);
bufferPool.release(buffer);
- LOG.debug("Stream closed, {} frames sent", frameCount);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Stream closed, {} frames sent", frameCount);
// Notify without holding locks.
notifySuccess();
}
@@ -139,7 +140,8 @@ public class MessageOutputStream extends OutputStream
closed = fin;
BufferUtil.flipToFlush(buffer, 0);
- LOG.debug("flush({}): {}", fin, BufferUtil.toDetailString(buffer));
+ if (LOG.isDebugEnabled())
+ LOG.debug("flush({}): {}", fin, BufferUtil.toDetailString(buffer));
frame.setPayload(buffer);
frame.setFin(fin);
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageWriter.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageWriter.java
index 5afe710c1b..ed968f3800 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageWriter.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageWriter.java
@@ -30,8 +30,8 @@ import org.eclipse.jetty.websocket.api.BatchMode;
import org.eclipse.jetty.websocket.api.WriteCallback;
import org.eclipse.jetty.websocket.api.extensions.OutgoingFrames;
import org.eclipse.jetty.websocket.common.BlockingWriteCallback;
-import org.eclipse.jetty.websocket.common.WebSocketSession;
import org.eclipse.jetty.websocket.common.BlockingWriteCallback.WriteBlocker;
+import org.eclipse.jetty.websocket.common.WebSocketSession;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
/**
@@ -121,7 +121,8 @@ public class MessageWriter extends Writer
{
flush(true);
bufferPool.release(buffer);
- LOG.debug("Stream closed, {} frames sent", frameCount);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Stream closed, {} frames sent", frameCount);
// Notify without holding locks.
notifySuccess();
}
@@ -143,7 +144,8 @@ public class MessageWriter extends Writer
closed = fin;
ByteBuffer data = utf.getByteBuffer();
- LOG.debug("flush({}): {}", fin, BufferUtil.toDetailString(buffer));
+ if (LOG.isDebugEnabled())
+ LOG.debug("flush({}): {}", fin, BufferUtil.toDetailString(buffer));
frame.setPayload(data);
frame.setFin(fin);
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventCapture.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventCapture.java
index 38451bb383..64b417dae5 100644
--- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventCapture.java
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventCapture.java
@@ -18,10 +18,6 @@
package org.eclipse.jetty.websocket.common.events;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.startsWith;
-
import java.util.regex.Pattern;
import org.eclipse.jetty.toolchain.test.EventQueue;
@@ -29,6 +25,10 @@ import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.junit.Assert;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.startsWith;
+
@SuppressWarnings("serial")
public class EventCapture extends EventQueue<String>
{
@@ -67,7 +67,8 @@ public class EventCapture extends EventQueue<String>
public void add(String format, Object... args)
{
String msg = String.format(format,args);
- LOG.debug("EVENT: {}",msg);
+ if (LOG.isDebugEnabled())
+ LOG.debug("EVENT: {}",msg);
super.offer(msg);
}
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/LocalWebSocketConnection.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/LocalWebSocketConnection.java
index 2244c93cb5..e3c109b653 100644
--- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/LocalWebSocketConnection.java
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/LocalWebSocketConnection.java
@@ -82,21 +82,24 @@ public class LocalWebSocketConnection implements LogicalConnection, IncomingFram
@Override
public void close(int statusCode, String reason)
{
- LOG.debug("close({}, {})",statusCode,reason);
+ if (LOG.isDebugEnabled())
+ LOG.debug("close({}, {})",statusCode,reason);
CloseInfo close = new CloseInfo(statusCode,reason);
ioState.onCloseLocal(close);
}
public void connect()
{
- LOG.debug("connect()");
+ if (LOG.isDebugEnabled())
+ LOG.debug("connect()");
ioState.onConnected();
}
@Override
public void disconnect()
{
- LOG.debug("disconnect()");
+ if (LOG.isDebugEnabled())
+ LOG.debug("disconnect()");
}
@Override
@@ -179,7 +182,8 @@ public class LocalWebSocketConnection implements LogicalConnection, IncomingFram
@Override
public void onConnectionStateChange(ConnectionState state)
{
- LOG.debug("Connection State Change: {}",state);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Connection State Change: {}",state);
switch (state)
{
case CLOSED:
@@ -200,7 +204,8 @@ public class LocalWebSocketConnection implements LogicalConnection, IncomingFram
public void open()
{
- LOG.debug("open()");
+ if (LOG.isDebugEnabled())
+ LOG.debug("open()");
ioState.onOpened();
}
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageWriterTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageWriterTest.java
index 43f68ecf00..d65214ec7c 100644
--- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageWriterTest.java
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageWriterTest.java
@@ -18,8 +18,6 @@
package org.eclipse.jetty.websocket.common.message;
-import static org.hamcrest.Matchers.is;
-
import java.util.Arrays;
import org.eclipse.jetty.io.MappedByteBufferPool;
@@ -40,6 +38,8 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
+import static org.hamcrest.Matchers.is;
+
public class MessageWriterTest
{
private static final Logger LOG = Log.getLogger(MessageWriterTest.class);
@@ -122,7 +122,8 @@ public class MessageWriterTest
{
int bufsize = (int)(policy.getMaxTextMessageBufferSize() * 2.5);
char buf[] = new char[bufsize];
- LOG.debug("Buffer size: {}",bufsize);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Buffer size: {}",bufsize);
Arrays.fill(buf,'x');
buf[bufsize - 1] = 'o'; // mark last entry for debugging
diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/TrackingInputStreamSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/TrackingInputStreamSocket.java
index e552ab4293..8aa4b09012 100644
--- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/TrackingInputStreamSocket.java
+++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/TrackingInputStreamSocket.java
@@ -18,8 +18,6 @@
package org.eclipse.jetty.websocket.common.message;
-import static org.hamcrest.Matchers.is;
-
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.CountDownLatch;
@@ -35,6 +33,8 @@ import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.junit.Assert;
+import static org.hamcrest.Matchers.is;
+
@WebSocket
public class TrackingInputStreamSocket
{
@@ -76,7 +76,8 @@ public class TrackingInputStreamSocket
@OnWebSocketClose
public void onClose(int statusCode, String reason)
{
- LOG.debug("{} onClose({},{})",id,statusCode,reason);
+ if (LOG.isDebugEnabled())
+ LOG.debug("{} onClose({},{})",id,statusCode,reason);
closeCode = statusCode;
closeMessage.append(reason);
closeLatch.countDown();
@@ -91,7 +92,8 @@ public class TrackingInputStreamSocket
@OnWebSocketMessage
public void onInputStream(InputStream stream)
{
- LOG.debug("{} onInputStream({})",id,stream);
+ if (LOG.isDebugEnabled())
+ LOG.debug("{} onInputStream({})",id,stream);
try
{
String msg = IO.toString(stream);
diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java
index b85806ef00..0686827af5 100644
--- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java
+++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java
@@ -512,8 +512,11 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc
extensionStack.configure(wsConnection.getParser());
extensionStack.configure(wsConnection.getGenerator());
- LOG.debug("HttpConnection: {}", http);
- LOG.debug("WebSocketConnection: {}", wsConnection);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("HttpConnection: {}", http);
+ LOG.debug("WebSocketConnection: {}", wsConnection);
+ }
// Setup Session
WebSocketSession session = createSession(request.getRequestURI(), driver, wsConnection);
@@ -553,11 +556,15 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc
// Tell jetty about the new upgraded connection
request.setServletAttribute(HttpConnection.UPGRADE_CONNECTION_ATTRIBUTE, wsConnection);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Handshake Response: {}", handshaker);
+
// Process (version specific) handshake response
- LOG.debug("Handshake Response: {}", handshaker);
handshaker.doHandshakeResponse(request, response);
- LOG.debug("Websocket upgrade {} {} {} {}", request.getRequestURI(), version, response.getAcceptedSubProtocol(), wsConnection);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Websocket upgrade {} {} {} {}", request.getRequestURI(), version, response.getAcceptedSubProtocol(), wsConnection);
+
return true;
}
}
diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilter.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilter.java
index 76b7b06ad0..b2a9deb092 100644
--- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilter.java
+++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilter.java
@@ -20,7 +20,6 @@ package org.eclipse.jetty.websocket.server;
import java.io.IOException;
import java.util.EnumSet;
-
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
@@ -66,7 +65,9 @@ public class WebSocketUpgradeFilter extends ContainerLifeCycle implements Filter
fholder.setDisplayName("WebSocket Upgrade Filter");
String pathSpec = "/*";
context.addFilter(fholder,pathSpec,EnumSet.of(DispatcherType.REQUEST));
- LOG.debug("Adding {} mapped to {} to {}",filter,pathSpec,context);
+
+ if (LOG.isDebugEnabled())
+ LOG.debug("Adding {} mapped to {} to {}",filter,pathSpec,context);
// Store reference to the WebSocketUpgradeFilter
context.setAttribute(WebSocketUpgradeFilter.class.getName(),filter);
diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/PathMappings.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/PathMappings.java
index 454b5c95a1..243af2d86d 100644
--- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/PathMappings.java
+++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/pathmap/PathMappings.java
@@ -177,7 +177,8 @@ public class PathMappings<E> implements Iterable<MappedResource<E>>, Dumpable
}
// TODO: warning on replacement of existing mapping?
mappings.add(entry);
- LOG.debug("Added {} to {}",entry,this);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Added {} to {}",entry,this);
Collections.sort(mappings);
}

Back to the top