Using connector.getByteBufferPool() vs creating a new pool per WebSocketAsyncConnection
This commit is contained in:
parent
beca3f9bd0
commit
63ead191bf
|
@ -12,7 +12,6 @@ import org.eclipse.jetty.io.AsyncConnection;
|
|||
import org.eclipse.jetty.io.AsyncEndPoint;
|
||||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
import org.eclipse.jetty.io.RuntimeIOException;
|
||||
import org.eclipse.jetty.io.StandardByteBufferPool;
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.FutureCallback;
|
||||
|
@ -58,11 +57,11 @@ public class WebSocketAsyncConnection extends AbstractAsyncConnection implements
|
|||
// TODO: are extensions going to layer the connection?
|
||||
private List<ExtensionConfig> extensions;
|
||||
|
||||
public WebSocketAsyncConnection(AsyncEndPoint endp, Executor executor, WebSocketPolicy policy)
|
||||
public WebSocketAsyncConnection(AsyncEndPoint endp, Executor executor, WebSocketPolicy policy, ByteBufferPool bufferPool)
|
||||
{
|
||||
super(endp,executor);
|
||||
this.policy = policy;
|
||||
this.bufferPool = new StandardByteBufferPool(policy.getBufferSize());
|
||||
this.bufferPool = bufferPool;
|
||||
this.generator = new Generator(policy);
|
||||
this.parser = new Parser(policy);
|
||||
this.extensions = new ArrayList<>();
|
||||
|
|
|
@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.eclipse.jetty.io.AsyncEndPoint;
|
||||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
import org.eclipse.jetty.server.HttpConnection;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
|
@ -338,7 +339,8 @@ public class WebSocketServerFactory extends AbstractLifeCycle implements WebSock
|
|||
HttpConnection http = HttpConnection.getCurrentConnection();
|
||||
AsyncEndPoint endp = http.getEndPoint();
|
||||
Executor executor = http.getConnector().findExecutor();
|
||||
WebSocketAsyncConnection connection = new WebSocketAsyncConnection(endp,executor,websocket.getPolicy());
|
||||
ByteBufferPool bufferPool = http.getConnector().getByteBufferPool();
|
||||
WebSocketAsyncConnection connection = new WebSocketAsyncConnection(endp,executor,websocket.getPolicy(),bufferPool);
|
||||
endp.setAsyncConnection(connection);
|
||||
connection.getParser().addListener(websocket);
|
||||
|
||||
|
|
Loading…
Reference in New Issue