Skip to content

Commit

Permalink
[WFCORE-6873] Remoting: use subsystem type endpoint for outbound comm…
Browse files Browse the repository at this point in the history
…unication
  • Loading branch information
tadamski committed Jul 1, 2024
1 parent 6a02058 commit d0e4cc5
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Endpoint> endpointConsumer;
private final Supplier<XnioWorker> workerSupplier;
Expand All @@ -40,6 +41,7 @@ public EndpointService(final Consumer<Endpoint> endpointConsumer, final Supplier
nodeName = "remote";
}
endpointName = type == EndpointType.SUBSYSTEM ? nodeName : nodeName + ":" + type;
this.type = type;
this.optionMap = optionMap;
}

Expand All @@ -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} */
Expand All @@ -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 {
Expand Down

0 comments on commit d0e4cc5

Please sign in to comment.