Skip to content

Commit 5b5c360

Browse files
use crossProjectEnabled() method
1 parent 70d6ac0 commit 5b5c360

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

server/src/main/java/org/elasticsearch/transport/RemoteClusterService.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ void ensureConnected(String clusterAlias, ActionListener<Void> listener) {
229229
* it returns an empty value where we default/fall back to true.
230230
*/
231231
public Optional<Boolean> isSkipUnavailable(String clusterAlias) {
232-
if (crossProjectModeDecider.crossProjectEnabled()) {
232+
if (crossProjectEnabled()) {
233233
return Optional.empty();
234234
} else {
235235
return Optional.of(getRemoteClusterConnection(clusterAlias).isSkipUnavailable());
@@ -365,15 +365,14 @@ public synchronized void updateRemoteCluster(
365365
boolean forceRebuild,
366366
ActionListener<RemoteClusterConnectionStatus> listener
367367
) {
368-
final var crossProjectEnabled = crossProjectModeDecider.crossProjectEnabled();
369368
final var projectId = config.originProjectId();
370369
final var clusterAlias = config.linkedProjectAlias();
371370
final var connectionMap = getConnectionsMapForProject(projectId);
372371
RemoteClusterConnection remote = connectionMap.get(clusterAlias);
373372

374373
if (remote == null) {
375374
// this is a new cluster we have to add a new representation
376-
remote = new RemoteClusterConnection(config, transportService, remoteClusterCredentialsManager, crossProjectEnabled);
375+
remote = new RemoteClusterConnection(config, transportService, remoteClusterCredentialsManager, crossProjectEnabled());
377376
connectionMap.put(clusterAlias, remote);
378377
remote.ensureConnected(listener.map(ignored -> RemoteClusterConnectionStatus.CONNECTED));
379378
} else if (forceRebuild || remote.shouldRebuildConnection(config)) {
@@ -384,7 +383,7 @@ public synchronized void updateRemoteCluster(
384383
logger.warn("project [" + projectId + "] failed to close remote cluster connections for cluster: " + clusterAlias, e);
385384
}
386385
connectionMap.remove(clusterAlias);
387-
remote = new RemoteClusterConnection(config, transportService, remoteClusterCredentialsManager, crossProjectEnabled);
386+
remote = new RemoteClusterConnection(config, transportService, remoteClusterCredentialsManager, crossProjectEnabled());
388387
connectionMap.put(clusterAlias, remote);
389388
remote.ensureConnected(listener.map(ignored -> RemoteClusterConnectionStatus.RECONNECTED));
390389
} else if (remote.isSkipUnavailable() != config.skipUnavailable()) {

0 commit comments

Comments
 (0)