Guard open connection call in RemoteClusterConnection (#44921)
Fixes an issue where a call to openConnection was not properly guarded, allowing an exception to bubble up to the uncaught exception handler, causing test failures. Closes #44912
This commit is contained in:
parent
a041d1eacf
commit
1561ab5420
|
@ -419,14 +419,6 @@ final class RemoteClusterConnection implements TransportConnectionListener, Clos
|
|||
}
|
||||
|
||||
if (seedNodes.hasNext()) {
|
||||
final DiscoveryNode seedNode = maybeAddProxyAddress(proxyAddress, seedNodes.next().get());
|
||||
logger.debug("[{}] opening connection to seed node: [{}] proxy address: [{}]", clusterAlias, seedNode,
|
||||
proxyAddress);
|
||||
final ConnectionProfile profile = ConnectionProfile.buildSingleChannelProfile(TransportRequestOptions.Type.REG);
|
||||
|
||||
final StepListener<Transport.Connection> openConnectionStep = new StepListener<>();
|
||||
connectionManager.openConnection(seedNode, profile, openConnectionStep);
|
||||
|
||||
final Consumer<Exception> onFailure = e -> {
|
||||
if (e instanceof ConnectTransportException ||
|
||||
e instanceof IOException ||
|
||||
|
@ -443,6 +435,17 @@ final class RemoteClusterConnection implements TransportConnectionListener, Clos
|
|||
listener.onFailure(e);
|
||||
};
|
||||
|
||||
final DiscoveryNode seedNode = maybeAddProxyAddress(proxyAddress, seedNodes.next().get());
|
||||
logger.debug("[{}] opening connection to seed node: [{}] proxy address: [{}]", clusterAlias, seedNode,
|
||||
proxyAddress);
|
||||
final ConnectionProfile profile = ConnectionProfile.buildSingleChannelProfile(TransportRequestOptions.Type.REG);
|
||||
final StepListener<Transport.Connection> openConnectionStep = new StepListener<>();
|
||||
try {
|
||||
connectionManager.openConnection(seedNode, profile, openConnectionStep);
|
||||
} catch (Exception e) {
|
||||
onFailure.accept(e);
|
||||
}
|
||||
|
||||
final StepListener<TransportService.HandshakeResponse> handShakeStep = new StepListener<>();
|
||||
openConnectionStep.whenComplete(connection -> {
|
||||
ConnectionProfile connectionProfile = connectionManager.getConnectionProfile();
|
||||
|
|
Loading…
Reference in New Issue