@@ -128,10 +128,10 @@ public void checkRemoteClusterLicenseAndFetchLeaderIndexMetadataAndHistoryUUIDs(
128128 return ;
129129 }
130130
131- final Client leaderClient = client .getRemoteClusterClient (clusterAlias );
132- hasPrivilegesToFollowIndices (leaderClient , new String [] {leaderIndex }, e -> {
131+ final Client remoteClient = client .getRemoteClusterClient (clusterAlias );
132+ hasPrivilegesToFollowIndices (remoteClient , new String [] {leaderIndex }, e -> {
133133 if (e == null ) {
134- fetchLeaderHistoryUUIDs (leaderClient , leaderIndexMetaData , onFailure , historyUUIDs ->
134+ fetchLeaderHistoryUUIDs (remoteClient , leaderIndexMetaData , onFailure , historyUUIDs ->
135135 consumer .accept (historyUUIDs , leaderIndexMetaData ));
136136 } else {
137137 onFailure .accept (e );
@@ -179,7 +179,7 @@ public void checkRemoteClusterLicenseAndFetchClusterState(
179179 *
180180 * @param client the client
181181 * @param clusterAlias the remote cluster alias
182- * @param leaderClient the leader client to use to execute cluster state API
182+ * @param remoteClient the remote client to use to execute cluster state API
183183 * @param request the cluster state request
184184 * @param onFailure the failure consumer
185185 * @param leaderClusterStateConsumer the leader cluster state consumer
@@ -189,7 +189,7 @@ public void checkRemoteClusterLicenseAndFetchClusterState(
189189 private void checkRemoteClusterLicenseAndFetchClusterState (
190190 final Client client ,
191191 final String clusterAlias ,
192- final Client leaderClient ,
192+ final Client remoteClient ,
193193 final ClusterStateRequest request ,
194194 final Consumer <Exception > onFailure ,
195195 final Consumer <ClusterState > leaderClusterStateConsumer ,
@@ -206,7 +206,7 @@ public void onResponse(final RemoteClusterLicenseChecker.LicenseCheck licenseChe
206206 final ActionListener <ClusterStateResponse > clusterStateListener =
207207 ActionListener .wrap (s -> leaderClusterStateConsumer .accept (s .getState ()), onFailure );
208208 // following an index in remote cluster, so use remote client to fetch leader index metadata
209- leaderClient .admin ().cluster ().state (request , clusterStateListener );
209+ remoteClient .admin ().cluster ().state (request , clusterStateListener );
210210 } else {
211211 onFailure .accept (nonCompliantLicense .apply (licenseCheck ));
212212 }
@@ -221,17 +221,17 @@ public void onFailure(final Exception e) {
221221 }
222222
223223 /**
224- * Fetches the history UUIDs for leader index on per shard basis using the specified leaderClient .
224+ * Fetches the history UUIDs for leader index on per shard basis using the specified remoteClient .
225225 *
226- * @param leaderClient the leader client
226+ * @param remoteClient the remote client
227227 * @param leaderIndexMetaData the leader index metadata
228228 * @param onFailure the failure consumer
229229 * @param historyUUIDConsumer the leader index history uuid and consumer
230230 */
231231 // NOTE: Placed this method here; in order to avoid duplication of logic for fetching history UUIDs
232232 // in case of following a local or a remote cluster.
233233 public void fetchLeaderHistoryUUIDs (
234- final Client leaderClient ,
234+ final Client remoteClient ,
235235 final IndexMetaData leaderIndexMetaData ,
236236 final Consumer <Exception > onFailure ,
237237 final Consumer <String []> historyUUIDConsumer ) {
@@ -274,20 +274,20 @@ public void fetchLeaderHistoryUUIDs(
274274 IndicesStatsRequest request = new IndicesStatsRequest ();
275275 request .clear ();
276276 request .indices (leaderIndex );
277- leaderClient .admin ().indices ().stats (request , ActionListener .wrap (indicesStatsHandler , onFailure ));
277+ remoteClient .admin ().indices ().stats (request , ActionListener .wrap (indicesStatsHandler , onFailure ));
278278 }
279279
280280 /**
281281 * Check if the user executing the current action has privileges to follow the specified indices on the cluster specified by the leader
282282 * client. The specified callback will be invoked with null if the user has the necessary privileges to follow the specified indices,
283283 * otherwise the callback will be invoked with an exception outlining the authorization error.
284284 *
285- * @param leaderClient the leader client
285+ * @param remoteClient the remote client
286286 * @param indices the indices
287287 * @param handler the callback
288288 */
289- public void hasPrivilegesToFollowIndices (final Client leaderClient , final String [] indices , final Consumer <Exception > handler ) {
290- Objects .requireNonNull (leaderClient , "leaderClient " );
289+ public void hasPrivilegesToFollowIndices (final Client remoteClient , final String [] indices , final Consumer <Exception > handler ) {
290+ Objects .requireNonNull (remoteClient , "remoteClient " );
291291 Objects .requireNonNull (indices , "indices" );
292292 if (indices .length == 0 ) {
293293 throw new IllegalArgumentException ("indices must not be empty" );
@@ -298,7 +298,7 @@ public void hasPrivilegesToFollowIndices(final Client leaderClient, final String
298298 return ;
299299 }
300300
301- ThreadContext threadContext = leaderClient .threadPool ().getThreadContext ();
301+ ThreadContext threadContext = remoteClient .threadPool ().getThreadContext ();
302302 SecurityContext securityContext = new SecurityContext (Settings .EMPTY , threadContext );
303303 String username = securityContext .getUser ().principal ();
304304
@@ -332,7 +332,7 @@ public void hasPrivilegesToFollowIndices(final Client leaderClient, final String
332332 handler .accept (Exceptions .authorizationError (message .toString ()));
333333 }
334334 };
335- leaderClient .execute (HasPrivilegesAction .INSTANCE , request , ActionListener .wrap (responseHandler , handler ));
335+ remoteClient .execute (HasPrivilegesAction .INSTANCE , request , ActionListener .wrap (responseHandler , handler ));
336336 }
337337
338338 public static Client wrapClient (Client client , Map <String , String > headers ) {
0 commit comments