Guarded calls to LOG.debug() with if (LOG.isDebugEnabled()) to reduce allocation of varargs Object[].
This commit is contained in:
parent
406eba7e26
commit
745f757552
|
@ -36,7 +36,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.servlet.ServletContainerInitializer;
|
||||
import javax.servlet.annotation.HandlesTypes;
|
||||
|
||||
|
@ -557,16 +556,16 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
|||
boolean timeout = !latch.await(getMaxScanWait(context), TimeUnit.SECONDS);
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
{
|
||||
{
|
||||
for (ParserTask p:_parserTasks)
|
||||
LOG.debug("Scanned {} in {}ms", p.getResource(), TimeUnit.MILLISECONDS.convert(p.getStatistic().getElapsed(), TimeUnit.NANOSECONDS));
|
||||
|
||||
LOG.debug("Scanned {} container path jars, {} WEB-INF/lib jars, {} WEB-INF/classes dirs in {}ms for context {}",
|
||||
_containerPathStats.getTotal(), _webInfLibStats.getTotal(), _webInfClassesStats.getTotal(),
|
||||
(TimeUnit.MILLISECONDS.convert(System.nanoTime()-start, TimeUnit.NANOSECONDS)),
|
||||
context);
|
||||
}
|
||||
|
||||
LOG.debug("Scanned {} container path jars, {} WEB-INF/lib jars, {} WEB-INF/classes dirs in {}ms for context {}",
|
||||
_containerPathStats.getTotal(), _webInfLibStats.getTotal(), _webInfClassesStats.getTotal(),
|
||||
(TimeUnit.MILLISECONDS.convert(System.nanoTime()-start, TimeUnit.NANOSECONDS)),
|
||||
context);
|
||||
|
||||
|
||||
if (timeout)
|
||||
me.add(new Exception("Timeout scanning annotations"));
|
||||
me.ifExceptionThrow();
|
||||
|
|
|
@ -214,7 +214,8 @@ public abstract class HttpDestination implements Destination, Closeable, Dumpabl
|
|||
public void close()
|
||||
{
|
||||
abort(new AsynchronousCloseException());
|
||||
LOG.debug("Closed {}", this);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Closed {}", this);
|
||||
}
|
||||
|
||||
public void release(Connection connection)
|
||||
|
|
|
@ -205,7 +205,8 @@ public abstract class HttpReceiver
|
|||
}
|
||||
catch (IOException x)
|
||||
{
|
||||
LOG.debug(x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug(x);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -451,7 +452,10 @@ public abstract class HttpReceiver
|
|||
{
|
||||
boolean updated = responseState.compareAndSet(from, to);
|
||||
if (!updated)
|
||||
LOG.debug("State update failed: {} -> {}: {}", from, to, responseState.get());
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("State update failed: {} -> {}: {}", from, to, responseState.get());
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,8 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
LOG.debug(x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug(x);
|
||||
failAndClose(x);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -123,7 +123,8 @@ public class HttpSenderOverHTTP extends HttpSender
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
LOG.debug(x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug(x);
|
||||
callback.failed(x);
|
||||
}
|
||||
}
|
||||
|
@ -181,7 +182,8 @@ public class HttpSenderOverHTTP extends HttpSender
|
|||
}
|
||||
catch (Exception x)
|
||||
{
|
||||
LOG.debug(x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug(x);
|
||||
callback.failed(x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,7 +173,8 @@ public class InputStreamContentProvider implements ContentProvider
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
LOG.debug(x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug(x);
|
||||
if (failure == null)
|
||||
{
|
||||
failure = x;
|
||||
|
|
|
@ -150,7 +150,8 @@ public class HttpConnectionOverFCGI extends AbstractConnection implements Connec
|
|||
}
|
||||
catch (Exception x)
|
||||
{
|
||||
LOG.debug(x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug(x);
|
||||
close(x);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.eclipse.jetty.util.log.Logger;
|
|||
|
||||
public class ParamsContentParser extends ContentParser
|
||||
{
|
||||
private static final Logger logger = Log.getLogger(ParamsContentParser.class);
|
||||
private static final Logger LOG = Log.getLogger(ParamsContentParser.class);
|
||||
|
||||
private final ServerParser.Listener listener;
|
||||
private State state = State.LENGTH;
|
||||
|
@ -212,7 +212,8 @@ public class ParamsContentParser extends ContentParser
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
logger.debug("Exception while invoking listener " + listener, x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Exception while invoking listener " + listener, x);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,7 +225,8 @@ public class ParamsContentParser extends ContentParser
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
logger.debug("Exception while invoking listener " + listener, x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Exception while invoking listener " + listener, x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -187,7 +187,8 @@ public class ResponseContentParser extends StreamContentParser
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
logger.debug("Exception while invoking listener " + listener, x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Exception while invoking listener " + listener, x);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -200,7 +201,8 @@ public class ResponseContentParser extends StreamContentParser
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
logger.debug("Exception while invoking listener " + listener, x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Exception while invoking listener " + listener, x);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +214,8 @@ public class ResponseContentParser extends StreamContentParser
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
logger.debug("Exception while invoking listener " + listener, x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Exception while invoking listener " + listener, x);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,7 +236,8 @@ public class ResponseContentParser extends StreamContentParser
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
logger.debug("Exception while invoking listener " + listener, x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Exception while invoking listener " + listener, x);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,7 +269,8 @@ public class ResponseContentParser extends StreamContentParser
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
logger.debug("Exception while invoking listener " + listener, x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Exception while invoking listener " + listener, x);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.eclipse.jetty.util.log.Logger;
|
|||
|
||||
public class StreamContentParser extends ContentParser
|
||||
{
|
||||
protected static final Logger logger = Log.getLogger(StreamContentParser.class);
|
||||
private static final Logger LOG = Log.getLogger(StreamContentParser.class);
|
||||
|
||||
private final FCGI.StreamType streamType;
|
||||
private final Parser.Listener listener;
|
||||
|
@ -87,7 +87,8 @@ public class StreamContentParser extends ContentParser
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
logger.debug("Exception while invoking listener " + listener, x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Exception while invoking listener " + listener, x);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +100,8 @@ public class StreamContentParser extends ContentParser
|
|||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
logger.debug("Exception while invoking listener " + listener, x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Exception while invoking listener " + listener, x);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,8 @@ public class ServerFCGIConnection extends AbstractConnection
|
|||
}
|
||||
catch (Exception x)
|
||||
{
|
||||
LOG.debug(x);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug(x);
|
||||
// TODO: fail and close ?
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -456,7 +456,8 @@ public class ConnectHandler extends HandlerWrapper
|
|||
@Override
|
||||
public Connection newConnection(SocketChannel channel, EndPoint endpoint, Object attachment) throws IOException
|
||||
{
|
||||
ConnectHandler.LOG.debug("Connected to {}", channel.getRemoteAddress());
|
||||
if (ConnectHandler.LOG.isDebugEnabled())
|
||||
ConnectHandler.LOG.debug("Connected to {}", channel.getRemoteAddress());
|
||||
ConnectContext connectContext = (ConnectContext)attachment;
|
||||
UpstreamConnection connection = newUpstreamConnection(endpoint, connectContext);
|
||||
connection.setInputBufferSize(getBufferSize());
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue