@@ -129,10 +129,10 @@ public void checkRemoteClusterLicenseAndFetchLeaderIndexMetadataAndHistoryUUIDs(
129129 return ;
130130 }
131131
132- final Client leaderClient = client .getRemoteClusterClient (clusterAlias );
133- hasPrivilegesToFollowIndices (leaderClient , new String [] {leaderIndex }, e -> {
132+ final Client remoteClient = client .getRemoteClusterClient (clusterAlias );
133+ hasPrivilegesToFollowIndices (remoteClient , new String [] {leaderIndex }, e -> {
134134 if (e == null ) {
135- fetchLeaderHistoryUUIDs (leaderClient , leaderIndexMetaData , onFailure , historyUUIDs ->
135+ fetchLeaderHistoryUUIDs (remoteClient , leaderIndexMetaData , onFailure , historyUUIDs ->
136136 consumer .accept (historyUUIDs , leaderIndexMetaData ));
137137 } else {
138138 onFailure .accept (e );
@@ -180,7 +180,7 @@ public void checkRemoteClusterLicenseAndFetchClusterState(
180180 *
181181 * @param client the client
182182 * @param clusterAlias the remote cluster alias
183- * @param leaderClient the leader client to use to execute cluster state API
183+ * @param remoteClient the remote client to use to execute cluster state API
184184 * @param request the cluster state request
185185 * @param onFailure the failure consumer
186186 * @param leaderClusterStateConsumer the leader cluster state consumer
@@ -190,7 +190,7 @@ public void checkRemoteClusterLicenseAndFetchClusterState(
190190 private void checkRemoteClusterLicenseAndFetchClusterState (
191191 final Client client ,
192192 final String clusterAlias ,
193- final Client leaderClient ,
193+ final Client remoteClient ,
194194 final ClusterStateRequest request ,
195195 final Consumer <Exception > onFailure ,
196196 final Consumer <ClusterState > leaderClusterStateConsumer ,
@@ -207,7 +207,7 @@ public void onResponse(final RemoteClusterLicenseChecker.LicenseCheck licenseChe
207207 final ActionListener <ClusterStateResponse > clusterStateListener =
208208 ActionListener .wrap (s -> leaderClusterStateConsumer .accept (s .getState ()), onFailure );
209209 // following an index in remote cluster, so use remote client to fetch leader index metadata
210- leaderClient .admin ().cluster ().state (request , clusterStateListener );
210+ remoteClient .admin ().cluster ().state (request , clusterStateListener );
211211 } else {
212212 onFailure .accept (nonCompliantLicense .apply (licenseCheck ));
213213 }
@@ -222,17 +222,17 @@ public void onFailure(final Exception e) {
222222 }
223223
224224 /**
225- * Fetches the history UUIDs for leader index on per shard basis using the specified leaderClient .
225+ * Fetches the history UUIDs for leader index on per shard basis using the specified remoteClient .
226226 *
227- * @param leaderClient the leader client
227+ * @param remoteClient the remote client
228228 * @param leaderIndexMetaData the leader index metadata
229229 * @param onFailure the failure consumer
230230 * @param historyUUIDConsumer the leader index history uuid and consumer
231231 */
232232 // NOTE: Placed this method here; in order to avoid duplication of logic for fetching history UUIDs
233233 // in case of following a local or a remote cluster.
234234 public void fetchLeaderHistoryUUIDs (
235- final Client leaderClient ,
235+ final Client remoteClient ,
236236 final IndexMetaData leaderIndexMetaData ,
237237 final Consumer <Exception > onFailure ,
238238 final Consumer <String []> historyUUIDConsumer ) {
@@ -275,20 +275,20 @@ public void fetchLeaderHistoryUUIDs(
275275 IndicesStatsRequest request = new IndicesStatsRequest ();
276276 request .clear ();
277277 request .indices (leaderIndex );
278- leaderClient .admin ().indices ().stats (request , ActionListener .wrap (indicesStatsHandler , onFailure ));
278+ remoteClient .admin ().indices ().stats (request , ActionListener .wrap (indicesStatsHandler , onFailure ));
279279 }
280280
281281 /**
282282 * Check if the user executing the current action has privileges to follow the specified indices on the cluster specified by the leader
283283 * client. The specified callback will be invoked with null if the user has the necessary privileges to follow the specified indices,
284284 * otherwise the callback will be invoked with an exception outlining the authorization error.
285285 *
286- * @param leaderClient the leader client
286+ * @param remoteClient the remote client
287287 * @param indices the indices
288288 * @param handler the callback
289289 */
290- public void hasPrivilegesToFollowIndices (final Client leaderClient , final String [] indices , final Consumer <Exception > handler ) {
291- Objects .requireNonNull (leaderClient , "leaderClient " );
290+ public void hasPrivilegesToFollowIndices (final Client remoteClient , final String [] indices , final Consumer <Exception > handler ) {
291+ Objects .requireNonNull (remoteClient , "remoteClient " );
292292 Objects .requireNonNull (indices , "indices" );
293293 if (indices .length == 0 ) {
294294 throw new IllegalArgumentException ("indices must not be empty" );
@@ -299,7 +299,7 @@ public void hasPrivilegesToFollowIndices(final Client leaderClient, final String
299299 return ;
300300 }
301301
302- ThreadContext threadContext = leaderClient .threadPool ().getThreadContext ();
302+ ThreadContext threadContext = remoteClient .threadPool ().getThreadContext ();
303303 SecurityContext securityContext = new SecurityContext (Settings .EMPTY , threadContext );
304304 String username = securityContext .getUser ().principal ();
305305
@@ -333,7 +333,7 @@ public void hasPrivilegesToFollowIndices(final Client leaderClient, final String
333333 handler .accept (Exceptions .authorizationError (message .toString ()));
334334 }
335335 };
336- leaderClient .execute (HasPrivilegesAction .INSTANCE , request , ActionListener .wrap (responseHandler , handler ));
336+ remoteClient .execute (HasPrivilegesAction .INSTANCE , request , ActionListener .wrap (responseHandler , handler ));
337337 }
338338
339339 public static Client wrapClient (Client client , Map <String , String > headers ) {
0 commit comments