Issue #3167 cleanups from review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
6ec615dc32
commit
a7e2ead7bc
|
@ -25,6 +25,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.ClientEndpointConfig;
|
||||
import javax.websocket.DeploymentException;
|
||||
|
@ -61,7 +62,11 @@ public class JavaxWebSocketClientContainer extends JavaxWebSocketContainer imple
|
|||
|
||||
public JavaxWebSocketClientContainer()
|
||||
{
|
||||
this(() -> new WebSocketCoreClient());
|
||||
this(() -> {
|
||||
WebSocketCoreClient coreClient = new WebSocketCoreClient();
|
||||
coreClient.getHttpClient().setName("Javax-WebSocketClient@" + Integer.toHexString(coreClient.getHttpClient().hashCode()));
|
||||
return coreClient;
|
||||
});
|
||||
}
|
||||
|
||||
public JavaxWebSocketClientContainer(Supplier<WebSocketCoreClient> coreClientFactory)
|
||||
|
@ -75,7 +80,7 @@ public class JavaxWebSocketClientContainer extends JavaxWebSocketContainer imple
|
|||
{
|
||||
super();
|
||||
this.coreClient = coreClient;
|
||||
this.addBean(this.coreClient);
|
||||
this.addBean(coreClient);
|
||||
this.objectFactory = new DecoratedObjectFactory();
|
||||
this.extensionRegistry = new WebSocketExtensionRegistry();
|
||||
this.frameHandlerFactory = new JavaxWebSocketClientFrameHandlerFactory(this);
|
||||
|
@ -103,8 +108,10 @@ public class JavaxWebSocketClientContainer extends JavaxWebSocketContainer imple
|
|||
if (coreClient == null)
|
||||
{
|
||||
coreClient = coreClientFactory.get();
|
||||
this.coreClient.getHttpClient().setName("Javax-WebSocketClient@" + Integer.toHexString(this.coreClient.getHttpClient().hashCode()));
|
||||
addManaged(coreClient);
|
||||
if (coreClient.isRunning())
|
||||
addBean(coreClient,false);
|
||||
else
|
||||
addManaged(coreClient);
|
||||
}
|
||||
|
||||
return coreClient;
|
||||
|
|
|
@ -18,6 +18,25 @@
|
|||
|
||||
package org.eclipse.jetty.websocket.javax.common;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.websocket.CloseReason;
|
||||
import javax.websocket.Decoder;
|
||||
import javax.websocket.EndpointConfig;
|
||||
import javax.websocket.MessageHandler;
|
||||
import javax.websocket.PongMessage;
|
||||
import javax.websocket.Session;
|
||||
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
|
@ -39,24 +58,6 @@ import org.eclipse.jetty.websocket.javax.common.messages.PartialByteBufferMessag
|
|||
import org.eclipse.jetty.websocket.javax.common.messages.PartialStringMessageSink;
|
||||
import org.eclipse.jetty.websocket.javax.common.util.InvokerUtils;
|
||||
|
||||
import javax.websocket.CloseReason;
|
||||
import javax.websocket.Decoder;
|
||||
import javax.websocket.EndpointConfig;
|
||||
import javax.websocket.MessageHandler;
|
||||
import javax.websocket.PongMessage;
|
||||
import javax.websocket.Session;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class JavaxWebSocketFrameHandler implements FrameHandler
|
||||
{
|
||||
private final Logger LOG;
|
||||
|
@ -217,9 +218,7 @@ public class JavaxWebSocketFrameHandler implements FrameHandler
|
|||
|
||||
if (errorHandle == null)
|
||||
{
|
||||
LOG.warn("Unhandled Error: Endpoint " + endpointInstance.getClass().getName() + " : " + cause);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("unhandled", cause);
|
||||
LOG.warn("Unhandled Error: " + endpointInstance, cause);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,25 +18,9 @@
|
|||
|
||||
package org.eclipse.jetty.websocket.javax.tests.client;
|
||||
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.websocket.core.FrameHandler;
|
||||
import org.eclipse.jetty.websocket.core.MessageHandler;
|
||||
import org.eclipse.jetty.websocket.core.server.Negotiation;
|
||||
import org.eclipse.jetty.websocket.javax.tests.CoreServer;
|
||||
import org.eclipse.jetty.websocket.javax.tests.WSEventTracker;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInfo;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.ContainerProvider;
|
||||
import javax.websocket.DecodeException;
|
||||
import javax.websocket.Decoder;
|
||||
import javax.websocket.EndpointConfig;
|
||||
import javax.websocket.OnMessage;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketContainer;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
@ -47,8 +31,25 @@ import java.util.concurrent.BlockingQueue;
|
|||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import javax.websocket.ClientEndpoint;
|
||||
import javax.websocket.ContainerProvider;
|
||||
import javax.websocket.DecodeException;
|
||||
import javax.websocket.Decoder;
|
||||
import javax.websocket.EndpointConfig;
|
||||
import javax.websocket.OnMessage;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.WebSocketContainer;
|
||||
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.websocket.core.FrameHandler;
|
||||
import org.eclipse.jetty.websocket.core.MessageHandler;
|
||||
import org.eclipse.jetty.websocket.core.server.Negotiation;
|
||||
import org.eclipse.jetty.websocket.javax.tests.CoreServer;
|
||||
import org.eclipse.jetty.websocket.javax.tests.WSEventTracker;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInfo;
|
||||
|
||||
public class DecoderReaderManySmallTest
|
||||
{
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
|
||||
package org.eclipse.jetty.websocket.javax.tests.server.sockets;
|
||||
|
||||
import javax.websocket.OnError;
|
||||
import javax.websocket.OnMessage;
|
||||
import javax.websocket.OnOpen;
|
||||
import javax.websocket.Session;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
|
||||
import org.eclipse.jetty.websocket.core.WebSocketTimeoutException;
|
||||
|
||||
@ServerEndpoint(value = "/idle-onopen-socket")
|
||||
public class IdleTimeoutOnOpenSocket
|
||||
{
|
||||
|
@ -37,4 +40,11 @@ public class IdleTimeoutOnOpenSocket
|
|||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
@OnError
|
||||
public void onError(Throwable cause)
|
||||
{
|
||||
if (!(cause instanceof WebSocketTimeoutException))
|
||||
throw new RuntimeException(cause);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue