From 2ed620b1f493857a92d27199e0ccf5ecc23367d7 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 23 Aug 2017 14:46:41 -0700 Subject: [PATCH] Fixed #1766 - removing common executor/bufferpool in JettyClientContainerProvider --- .../jsr356/JettyClientContainerProvider.java | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/JettyClientContainerProvider.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/JettyClientContainerProvider.java index 65056797bed..69037a24f65 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/JettyClientContainerProvider.java +++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/JettyClientContainerProvider.java @@ -19,17 +19,13 @@ package org.eclipse.jetty.websocket.jsr356; import java.lang.reflect.Method; -import java.util.concurrent.Executor; import javax.websocket.ContainerProvider; import javax.websocket.WebSocketContainer; -import org.eclipse.jetty.io.ByteBufferPool; -import org.eclipse.jetty.io.MappedByteBufferPool; import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.eclipse.jetty.util.thread.ShutdownThread; import org.eclipse.jetty.websocket.api.WebSocketPolicy; import org.eclipse.jetty.websocket.common.scopes.SimpleContainerScope; @@ -47,11 +43,9 @@ public class JettyClientContainerProvider extends ContainerProvider private static final Logger LOG = Log.getLogger(JettyClientContainerProvider.class); private static boolean useSingleton = false; - private static WebSocketContainer INSTANCE; private static boolean useServerContainer = false; - private static Executor commonExecutor; - private static ByteBufferPool commonBufferPool; - + private static WebSocketContainer INSTANCE; + private static Object lock = new Object(); /** @@ -185,21 +179,7 @@ public class JettyClientContainerProvider extends ContainerProvider // Still no instance? if (webSocketContainer == null) { - if (commonExecutor == null) - { - QueuedThreadPool threadPool = new QueuedThreadPool(); - String name = "Jsr356Client@" + hashCode(); - threadPool.setName(name); - threadPool.setDaemon(true); - commonExecutor = threadPool; - } - - if (commonBufferPool == null) - { - commonBufferPool = new MappedByteBufferPool(); - } - - SimpleContainerScope containerScope = new SimpleContainerScope(WebSocketPolicy.newClientPolicy(), commonBufferPool, commonExecutor, null); + SimpleContainerScope containerScope = new SimpleContainerScope(WebSocketPolicy.newClientPolicy()); ClientContainer clientContainer = new ClientContainer(containerScope); if (contextHandler != null && contextHandler instanceof ContainerLifeCycle)