mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 15:17:30 -04:00
* Fix shadowed vars pt4 (#80842) Part of #19752. Fix more instances where local variable names were shadowing field names. * Fix shadowed vars pt5 (#80855) Part of #19752. Fix more instances where local variable names were shadowing field names. * Formatting Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
a2c1481ab8
commit
0a7392a1e8
43 changed files with 184 additions and 211 deletions
|
@ -96,7 +96,7 @@ class AwsEc2SeedHostsProvider implements SeedHostsProvider {
|
|||
|
||||
protected List<TransportAddress> fetchDynamicNodes() {
|
||||
|
||||
final List<TransportAddress> dynamicHosts = new ArrayList<>();
|
||||
final List<TransportAddress> dynamicHostAddresses = new ArrayList<>();
|
||||
|
||||
final DescribeInstancesResult descInstances;
|
||||
try (AmazonEc2Reference clientReference = awsEc2Service.client()) {
|
||||
|
@ -109,7 +109,7 @@ class AwsEc2SeedHostsProvider implements SeedHostsProvider {
|
|||
} catch (final AmazonClientException e) {
|
||||
logger.info("Exception while retrieving instance list from AWS API: {}", e.getMessage());
|
||||
logger.debug("Full exception:", e);
|
||||
return dynamicHosts;
|
||||
return dynamicHostAddresses;
|
||||
}
|
||||
|
||||
logger.trace("finding seed nodes...");
|
||||
|
@ -164,8 +164,8 @@ class AwsEc2SeedHostsProvider implements SeedHostsProvider {
|
|||
// Reading the node host from its metadata
|
||||
final String tagName = hostType.substring(TAG_PREFIX.length());
|
||||
logger.debug("reading hostname from [{}] instance tag", tagName);
|
||||
final List<Tag> tags = instance.getTags();
|
||||
for (final Tag tag : tags) {
|
||||
final List<Tag> tagList = instance.getTags();
|
||||
for (final Tag tag : tagList) {
|
||||
if (tag.getKey().equals(tagName)) {
|
||||
address = tag.getValue();
|
||||
logger.debug("using [{}] as the instance address", address);
|
||||
|
@ -179,7 +179,7 @@ class AwsEc2SeedHostsProvider implements SeedHostsProvider {
|
|||
final TransportAddress[] addresses = transportService.addressesFromString(address);
|
||||
for (int i = 0; i < addresses.length; i++) {
|
||||
logger.trace("adding {}, address {}, transport_address {}", instance.getInstanceId(), address, addresses[i]);
|
||||
dynamicHosts.add(addresses[i]);
|
||||
dynamicHostAddresses.add(addresses[i]);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
final String finalAddress = address;
|
||||
|
@ -198,9 +198,9 @@ class AwsEc2SeedHostsProvider implements SeedHostsProvider {
|
|||
}
|
||||
}
|
||||
|
||||
logger.debug("using dynamic transport addresses {}", dynamicHosts);
|
||||
logger.debug("using dynamic transport addresses {}", dynamicHostAddresses);
|
||||
|
||||
return dynamicHosts;
|
||||
return dynamicHostAddresses;
|
||||
}
|
||||
|
||||
private DescribeInstancesRequest buildDescribeInstancesRequest() {
|
||||
|
|
|
@ -28,14 +28,14 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
|
||||
class AwsEc2ServiceImpl implements AwsEc2Service {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(AwsEc2ServiceImpl.class);
|
||||
private static final Logger LOGGER = LogManager.getLogger(AwsEc2ServiceImpl.class);
|
||||
|
||||
private final AtomicReference<LazyInitializable<AmazonEc2Reference, ElasticsearchException>> lazyClientReference =
|
||||
new AtomicReference<>();
|
||||
|
||||
private AmazonEC2 buildClient(Ec2ClientSettings clientSettings) {
|
||||
final AWSCredentialsProvider credentials = buildCredentials(logger, clientSettings);
|
||||
final ClientConfiguration configuration = buildConfiguration(logger, clientSettings);
|
||||
final AWSCredentialsProvider credentials = buildCredentials(LOGGER, clientSettings);
|
||||
final ClientConfiguration configuration = buildConfiguration(LOGGER, clientSettings);
|
||||
return buildClient(credentials, configuration, clientSettings.endpoint);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class AwsEc2ServiceImpl implements AwsEc2Service {
|
|||
.withCredentials(credentials)
|
||||
.withClientConfiguration(configuration);
|
||||
if (Strings.hasText(endpoint)) {
|
||||
logger.debug("using explicit ec2 endpoint [{}]", endpoint);
|
||||
LOGGER.debug("using explicit ec2 endpoint [{}]", endpoint);
|
||||
builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, null));
|
||||
}
|
||||
return SocketAccess.doPrivileged(builder::build);
|
||||
|
|
|
@ -43,7 +43,7 @@ import java.util.function.Supplier;
|
|||
|
||||
public class Ec2DiscoveryPlugin extends Plugin implements DiscoveryPlugin, ReloadablePlugin {
|
||||
|
||||
private static Logger logger = LogManager.getLogger(Ec2DiscoveryPlugin.class);
|
||||
private static final Logger logger = LogManager.getLogger(Ec2DiscoveryPlugin.class);
|
||||
public static final String EC2 = "ec2";
|
||||
|
||||
static {
|
||||
|
@ -80,7 +80,7 @@ public class Ec2DiscoveryPlugin extends Plugin implements DiscoveryPlugin, Reloa
|
|||
}
|
||||
|
||||
@Override
|
||||
public NetworkService.CustomNameResolver getCustomNameResolver(Settings settings) {
|
||||
public NetworkService.CustomNameResolver getCustomNameResolver(Settings _settings) {
|
||||
logger.debug("Register _ec2_, _ec2:xxx_ network names");
|
||||
return new Ec2NameResolver();
|
||||
}
|
||||
|
@ -171,9 +171,9 @@ public class Ec2DiscoveryPlugin extends Plugin implements DiscoveryPlugin, Reloa
|
|||
}
|
||||
|
||||
@Override
|
||||
public void reload(Settings settings) {
|
||||
public void reload(Settings settingsToLoad) {
|
||||
// secure settings should be readable
|
||||
final Ec2ClientSettings clientSettings = Ec2ClientSettings.getClientSettings(settings);
|
||||
final Ec2ClientSettings clientSettings = Ec2ClientSettings.getClientSettings(settingsToLoad);
|
||||
ec2Service.refreshAndClearCache(clientSettings);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue