From d0e4cc5c263020cc50cfb897e97749b9a4a2b164 Mon Sep 17 00:00:00 2001 From: Tomasz Adamski Date: Mon, 1 Jul 2024 17:20:15 +0200 Subject: [PATCH] [WFCORE-6873] Remoting: use subsystem type endpoint for outbound communication --- .../main/java/org/jboss/as/remoting/EndpointService.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/remoting/subsystem/src/main/java/org/jboss/as/remoting/EndpointService.java b/remoting/subsystem/src/main/java/org/jboss/as/remoting/EndpointService.java index ff338d3040b..16280aaa079 100644 --- a/remoting/subsystem/src/main/java/org/jboss/as/remoting/EndpointService.java +++ b/remoting/subsystem/src/main/java/org/jboss/as/remoting/EndpointService.java @@ -29,6 +29,7 @@ public class EndpointService implements Service { protected final String endpointName; protected volatile Endpoint endpoint; + private final EndpointType type; protected final OptionMap optionMap; private final Consumer endpointConsumer; private final Supplier workerSupplier; @@ -40,6 +41,7 @@ public EndpointService(final Consumer endpointConsumer, final Supplier nodeName = "remote"; } endpointName = type == EndpointType.SUBSYSTEM ? nodeName : nodeName + ":" + type; + this.type = type; this.optionMap = optionMap; } @@ -58,6 +60,9 @@ public void start(final StartContext context) throws StartException { // Reuse the options for the remote connection factory for now this.endpoint = endpoint; endpointConsumer.accept(endpoint); + if (type == EndpointType.SUBSYSTEM) { + Endpoint.ENDPOINT_CONTEXT_MANAGER.setGlobalDefault(endpoint); + } } /** {@inheritDoc} */ @@ -73,6 +78,9 @@ public void stop(final StopContext context) { context.complete(); }); } + if (type == EndpointType.SUBSYSTEM) { + Endpoint.ENDPOINT_CONTEXT_MANAGER.setGlobalDefault(null); + } } public enum EndpointType {