Skip to content

Commit 6ab424e

Browse files
Removes support for null TransportService in RemoteClusterService (#137939)
This change is a follow up to #137406, removing a null check around the TransportService instance when registering the metric. This was only needed for a few test cases in the RemoteClusterServiceTests where a null instance was passed to the constructor. The change also cleans up the code for creating the TransportService instances in the test, cutting down on the LOC. Relates: #137406
1 parent 45ddd0b commit 6ab424e

File tree

2 files changed

+93
-432
lines changed

2 files changed

+93
-432
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,9 @@ public boolean isRemoteClusterServerEnabled() {
102102
* the functionality to do it the right way is not yet ready -- replace this code when it's ready.
103103
*/
104104
this.crossProjectEnabled = settings.getAsBoolean("serverless.cross_project.enabled", false);
105-
if (transportService != null) {
106-
transportService.getTelemetryProvider()
107-
.getMeterRegistry()
108-
.registerLongCounter(CONNECTION_ATTEMPT_FAILURES_COUNTER_NAME, "linked project connection attempt failure count", "count");
109-
}
105+
transportService.getTelemetryProvider()
106+
.getMeterRegistry()
107+
.registerLongCounter(CONNECTION_ATTEMPT_FAILURES_COUNTER_NAME, "linked project connection attempt failure count", "count");
110108
}
111109

112110
public RemoteClusterCredentialsManager getRemoteClusterCredentialsManager() {

0 commit comments

Comments
 (0)