Fixed #1766 - removing common executor/bufferpool in JettyClientContainerProvider

This commit is contained in:
Joakim Erdfelt 2017-08-23 14:46:41 -07:00
parent 7e764bad3e
commit 2ed620b1f4
1 changed files with 3 additions and 23 deletions

View File

@ -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)