Issue #8448 - remove blocker usage from websocket

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2022-08-17 17:28:38 +10:00
parent 206a899629
commit ac18a0aec2
8 changed files with 24 additions and 16 deletions

View File

@ -37,7 +37,7 @@ import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketSe
import org.eclipse.jetty.http.pathmap.PathSpec; import org.eclipse.jetty.http.pathmap.PathSpec;
import org.eclipse.jetty.http.pathmap.UriTemplatePathSpec; import org.eclipse.jetty.http.pathmap.UriTemplatePathSpec;
import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.Blocker; import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.eclipse.jetty.websocket.core.WebSocketComponents;
@ -304,7 +304,8 @@ public class JakartaWebSocketServerContainer extends JakartaWebSocketClientConta
throw new IllegalStateException(); throw new IllegalStateException();
ServletContextResponse baseResponse = baseRequest.getResponse(); ServletContextResponse baseResponse = baseRequest.getResponse();
try (Blocker.Callback callback = Blocker.callback()) FutureCallback callback = new FutureCallback();
try
{ {
// Set the wrapped req and resp as attributes on the ServletContext Request/Response, so they // Set the wrapped req and resp as attributes on the ServletContext Request/Response, so they
// are accessible when websocket-core calls back the Jetty WebSocket creator. // are accessible when websocket-core calls back the Jetty WebSocket creator.

View File

@ -39,7 +39,7 @@ import org.eclipse.jetty.ee10.websocket.server.internal.DelegatedServerUpgradeRe
import org.eclipse.jetty.ee10.websocket.server.internal.JettyServerFrameHandlerFactory; import org.eclipse.jetty.ee10.websocket.server.internal.JettyServerFrameHandlerFactory;
import org.eclipse.jetty.ee10.websocket.servlet.WebSocketUpgradeFilter; import org.eclipse.jetty.ee10.websocket.servlet.WebSocketUpgradeFilter;
import org.eclipse.jetty.http.pathmap.PathSpec; import org.eclipse.jetty.http.pathmap.PathSpec;
import org.eclipse.jetty.util.Blocker; import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.component.ContainerLifeCycle;
import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.component.LifeCycle;
@ -223,7 +223,8 @@ public class JettyWebSocketServerContainer extends ContainerLifeCycle implements
WebSocketNegotiator negotiator = WebSocketNegotiator.from(coreCreator, frameHandlerFactory); WebSocketNegotiator negotiator = WebSocketNegotiator.from(coreCreator, frameHandlerFactory);
Handshaker handshaker = webSocketMappings.getHandshaker(); Handshaker handshaker = webSocketMappings.getHandshaker();
try (Blocker.Callback callback = Blocker.callback()) FutureCallback callback = new FutureCallback();
try
{ {
// Set the wrapped req and resp as attributes on the ServletContext Request/Response, so they // Set the wrapped req and resp as attributes on the ServletContext Request/Response, so they
// are accessible when websocket-core calls back the Jetty WebSocket creator. // are accessible when websocket-core calls back the Jetty WebSocket creator.

View File

@ -30,8 +30,8 @@ import org.eclipse.jetty.ee10.websocket.server.internal.DelegatedServerUpgradeRe
import org.eclipse.jetty.ee10.websocket.server.internal.JettyServerFrameHandlerFactory; import org.eclipse.jetty.ee10.websocket.server.internal.JettyServerFrameHandlerFactory;
import org.eclipse.jetty.ee10.websocket.servlet.WebSocketUpgradeFilter; import org.eclipse.jetty.ee10.websocket.servlet.WebSocketUpgradeFilter;
import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.Blocker;
import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.Configuration;
import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.WebSocketConstants; import org.eclipse.jetty.websocket.core.WebSocketConstants;
@ -190,7 +190,8 @@ public abstract class JettyWebSocketServlet extends HttpServlet
if (mapping.getHandshaker().isWebSocketUpgradeRequest(request)) if (mapping.getHandshaker().isWebSocketUpgradeRequest(request))
{ {
// provide a null default customizer the customizer will be on the negotiator in the mapping // provide a null default customizer the customizer will be on the negotiator in the mapping
try (Blocker.Callback callback = Blocker.callback()) FutureCallback callback = new FutureCallback();
try
{ {
// Set the wrapped req and resp as attributes on the ServletContext Request/Response, so they // Set the wrapped req and resp as attributes on the ServletContext Request/Response, so they
// are accessible when websocket-core calls back the Jetty WebSocket creator. // are accessible when websocket-core calls back the Jetty WebSocket creator.

View File

@ -33,7 +33,7 @@ import org.eclipse.jetty.ee10.servlet.ServletContextRequest;
import org.eclipse.jetty.ee10.servlet.ServletContextResponse; import org.eclipse.jetty.ee10.servlet.ServletContextResponse;
import org.eclipse.jetty.ee10.servlet.ServletHandler; import org.eclipse.jetty.ee10.servlet.ServletHandler;
import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.Blocker; import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.component.LifeCycle;
@ -166,7 +166,8 @@ public class WebSocketUpgradeFilter implements Filter, Dumpable
if (mappings.getHandshaker().isWebSocketUpgradeRequest(baseRequest)) if (mappings.getHandshaker().isWebSocketUpgradeRequest(baseRequest))
{ {
// provide a null default customizer the customizer will be on the negotiator in the mapping // provide a null default customizer the customizer will be on the negotiator in the mapping
try (Blocker.Callback callback = Blocker.callback()) FutureCallback callback = new FutureCallback();
try
{ {
// Set the wrapped req and resp as attributes on the ServletContext Request/Response, so they // Set the wrapped req and resp as attributes on the ServletContext Request/Response, so they
// are accessible when websocket-core calls back the Jetty WebSocket creator. // are accessible when websocket-core calls back the Jetty WebSocket creator.

View File

@ -38,7 +38,7 @@ import org.eclipse.jetty.http.pathmap.PathSpec;
import org.eclipse.jetty.http.pathmap.UriTemplatePathSpec; import org.eclipse.jetty.http.pathmap.UriTemplatePathSpec;
import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response; import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.Blocker; import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.eclipse.jetty.websocket.core.WebSocketComponents;
@ -304,7 +304,8 @@ public class JakartaWebSocketServerContainer extends JakartaWebSocketClientConta
Request baseRequest = httpChannel.getCoreRequest(); Request baseRequest = httpChannel.getCoreRequest();
Response baseResponse = httpChannel.getCoreResponse(); Response baseResponse = httpChannel.getCoreResponse();
try (Blocker.Callback callback = Blocker.callback()) FutureCallback callback = new FutureCallback();
try
{ {
// Set the wrapped req and resp as attachments on the ServletContext Request/Response, so they // Set the wrapped req and resp as attachments on the ServletContext Request/Response, so they
// are accessible when websocket-core calls back the Jetty WebSocket creator. // are accessible when websocket-core calls back the Jetty WebSocket creator.

View File

@ -40,7 +40,7 @@ import org.eclipse.jetty.ee9.websocket.servlet.WebSocketUpgradeFilter;
import org.eclipse.jetty.http.pathmap.PathSpec; import org.eclipse.jetty.http.pathmap.PathSpec;
import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response; import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.Blocker; import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.component.ContainerLifeCycle;
import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.component.LifeCycle;
@ -222,7 +222,8 @@ public class JettyWebSocketServerContainer extends ContainerLifeCycle implements
Request baseRequest = httpChannel.getCoreRequest(); Request baseRequest = httpChannel.getCoreRequest();
Response baseResponse = httpChannel.getCoreResponse(); Response baseResponse = httpChannel.getCoreResponse();
try (Blocker.Callback callback = Blocker.callback()) FutureCallback callback = new FutureCallback();
try
{ {
// Set the wrapped req and resp as attachments on the ServletContext Request/Response, so they // Set the wrapped req and resp as attachments on the ServletContext Request/Response, so they
// are accessible when websocket-core calls back the Jetty WebSocket creator. // are accessible when websocket-core calls back the Jetty WebSocket creator.

View File

@ -32,8 +32,8 @@ import org.eclipse.jetty.ee9.websocket.server.internal.JettyServerFrameHandlerFa
import org.eclipse.jetty.ee9.websocket.servlet.WebSocketUpgradeFilter; import org.eclipse.jetty.ee9.websocket.servlet.WebSocketUpgradeFilter;
import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response; import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.Blocker;
import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.Configuration;
import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.WebSocketConstants; import org.eclipse.jetty.websocket.core.WebSocketConstants;
@ -193,7 +193,8 @@ public abstract class JettyWebSocketServlet extends HttpServlet
if (mapping.getHandshaker().isWebSocketUpgradeRequest(request)) if (mapping.getHandshaker().isWebSocketUpgradeRequest(request))
{ {
// provide a null default customizer the customizer will be on the negotiator in the mapping // provide a null default customizer the customizer will be on the negotiator in the mapping
try (Blocker.Callback callback = Blocker.callback()) FutureCallback callback = new FutureCallback();
try
{ {
// Set the wrapped req and resp as attributes on the ServletContext Request/Response, so they // Set the wrapped req and resp as attributes on the ServletContext Request/Response, so they
// are accessible when websocket-core calls back the Jetty WebSocket creator. // are accessible when websocket-core calls back the Jetty WebSocket creator.

View File

@ -33,7 +33,7 @@ import org.eclipse.jetty.ee9.servlet.FilterMapping;
import org.eclipse.jetty.ee9.servlet.ServletHandler; import org.eclipse.jetty.ee9.servlet.ServletHandler;
import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response; import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.Blocker; import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.component.LifeCycle;
@ -165,7 +165,8 @@ public class WebSocketUpgradeFilter implements Filter, Dumpable
if (mappings.getHandshaker().isWebSocketUpgradeRequest(baseRequest)) if (mappings.getHandshaker().isWebSocketUpgradeRequest(baseRequest))
{ {
// provide a null default customizer the customizer will be on the negotiator in the mapping // provide a null default customizer the customizer will be on the negotiator in the mapping
try (Blocker.Callback callback = Blocker.callback()) FutureCallback callback = new FutureCallback();
try
{ {
// Set the wrapped req and resp as attributes on the ServletContext Request/Response, so they // Set the wrapped req and resp as attributes on the ServletContext Request/Response, so they
// are accessible when websocket-core calls back the Jetty WebSocket creator. // are accessible when websocket-core calls back the Jetty WebSocket creator.