Removes AbstractComponent from several classes (#35566)
Removes inhertiting from AbstractComponent for some classes (mostly in the plugins module). Relates to #34488
This commit is contained in:
parent
fc63ea5357
commit
baf33b3162
|
@ -24,12 +24,14 @@ import com.microsoft.windowsazure.management.compute.models.DeploymentStatus;
|
|||
import com.microsoft.windowsazure.management.compute.models.HostedServiceGetDetailedResponse;
|
||||
import com.microsoft.windowsazure.management.compute.models.InstanceEndpoint;
|
||||
import com.microsoft.windowsazure.management.compute.models.RoleInstance;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.cloud.azure.classic.AzureServiceDisableException;
|
||||
import org.elasticsearch.cloud.azure.classic.AzureServiceRemoteException;
|
||||
import org.elasticsearch.cloud.azure.classic.management.AzureComputeService;
|
||||
import org.elasticsearch.cloud.azure.classic.management.AzureComputeService.Discovery;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.network.InetAddresses;
|
||||
import org.elasticsearch.common.network.NetworkAddress;
|
||||
import org.elasticsearch.common.network.NetworkService;
|
||||
|
@ -45,7 +47,9 @@ import java.net.InetSocketAddress;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AzureUnicastHostsProvider extends AbstractComponent implements UnicastHostsProvider {
|
||||
public class AzureUnicastHostsProvider implements UnicastHostsProvider {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(AzureUnicastHostsProvider.class);
|
||||
|
||||
public enum HostType {
|
||||
PRIVATE_IP("private_ip"),
|
||||
|
|
|
@ -28,17 +28,20 @@ import com.amazonaws.internal.StaticCredentialsProvider;
|
|||
import com.amazonaws.retry.RetryPolicy;
|
||||
import com.amazonaws.services.ec2.AmazonEC2;
|
||||
import com.amazonaws.services.ec2.AmazonEC2Client;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.common.Randomness;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.util.LazyInitializable;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
class AwsEc2ServiceImpl extends AbstractComponent implements AwsEc2Service {
|
||||
class AwsEc2ServiceImpl implements AwsEc2Service {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(AwsEc2ServiceImpl.class);
|
||||
|
||||
private final AtomicReference<LazyInitializable<AmazonEc2Reference, ElasticsearchException>> lazyClientReference =
|
||||
new AtomicReference<>();
|
||||
|
|
|
@ -27,9 +27,11 @@ import com.amazonaws.services.ec2.model.GroupIdentifier;
|
|||
import com.amazonaws.services.ec2.model.Instance;
|
||||
import com.amazonaws.services.ec2.model.Reservation;
|
||||
import com.amazonaws.services.ec2.model.Tag;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.apache.logging.log4j.util.Supplier;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
@ -44,13 +46,15 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import static java.util.Collections.disjoint;
|
||||
import static org.elasticsearch.discovery.ec2.AwsEc2Service.HostType.TAG_PREFIX;
|
||||
import static org.elasticsearch.discovery.ec2.AwsEc2Service.HostType.PRIVATE_DNS;
|
||||
import static org.elasticsearch.discovery.ec2.AwsEc2Service.HostType.PRIVATE_IP;
|
||||
import static org.elasticsearch.discovery.ec2.AwsEc2Service.HostType.PUBLIC_DNS;
|
||||
import static org.elasticsearch.discovery.ec2.AwsEc2Service.HostType.PUBLIC_IP;
|
||||
import static org.elasticsearch.discovery.ec2.AwsEc2Service.HostType.TAG_PREFIX;
|
||||
|
||||
class AwsEc2UnicastHostsProvider extends AbstractComponent implements UnicastHostsProvider {
|
||||
class AwsEc2UnicastHostsProvider implements UnicastHostsProvider {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(AwsEc2UnicastHostsProvider.class);
|
||||
|
||||
private final TransportService transportService;
|
||||
|
||||
|
|
|
@ -20,10 +20,12 @@
|
|||
package org.elasticsearch.discovery.ec2;
|
||||
|
||||
import com.amazonaws.util.EC2MetadataUtils;
|
||||
import org.elasticsearch.core.internal.io.IOUtils;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.network.NetworkService.CustomNameResolver;
|
||||
import org.elasticsearch.core.internal.io.IOUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
@ -51,7 +53,9 @@ import java.nio.charset.StandardCharsets;
|
|||
*
|
||||
* @author Paul_Loy (keteracel)
|
||||
*/
|
||||
class Ec2NameResolver extends AbstractComponent implements CustomNameResolver {
|
||||
class Ec2NameResolver implements CustomNameResolver {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(Ec2NameResolver.class);
|
||||
|
||||
/**
|
||||
* enum that can be added to over time with more meta-data types (such as ipv6 when this is available)
|
||||
|
|
|
@ -19,14 +19,6 @@
|
|||
|
||||
package org.elasticsearch.cloud.gce;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.api.client.googleapis.compute.ComputeCredential;
|
||||
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
|
||||
import com.google.api.client.http.GenericUrl;
|
||||
|
@ -41,17 +33,29 @@ import com.google.api.client.json.jackson2.JacksonFactory;
|
|||
import com.google.api.services.compute.Compute;
|
||||
import com.google.api.services.compute.model.Instance;
|
||||
import com.google.api.services.compute.model.InstanceList;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.apache.logging.log4j.util.Supplier;
|
||||
import org.elasticsearch.cloud.gce.util.Access;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Property;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.discovery.gce.RetryHttpInitializerWrapper;
|
||||
|
||||
public class GceInstancesServiceImpl extends AbstractComponent implements GceInstancesService {
|
||||
import java.io.IOException;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class GceInstancesServiceImpl implements GceInstancesService {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(GceInstancesServiceImpl.class);
|
||||
|
||||
// all settings just used for testing - not registered by default
|
||||
public static final Setting<Boolean> GCE_VALIDATE_CERTIFICATES =
|
||||
|
|
|
@ -19,21 +19,16 @@
|
|||
|
||||
package org.elasticsearch.discovery.gce;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.api.services.compute.model.AccessConfig;
|
||||
import com.google.api.services.compute.model.Instance;
|
||||
import com.google.api.services.compute.model.NetworkInterface;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.apache.logging.log4j.util.Supplier;
|
||||
import org.elasticsearch.cloud.gce.GceInstancesService;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.network.NetworkAddress;
|
||||
import org.elasticsearch.common.network.NetworkService;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
|
@ -44,9 +39,18 @@ import org.elasticsearch.common.unit.TimeValue;
|
|||
import org.elasticsearch.discovery.zen.UnicastHostsProvider;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
public class GceUnicastHostsProvider extends AbstractComponent implements UnicastHostsProvider {
|
||||
public class GceUnicastHostsProvider implements UnicastHostsProvider {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(GceUnicastHostsProvider.class);
|
||||
|
||||
/**
|
||||
* discovery.gce.tags: The gce discovery can filter machines to include in the cluster based on tags.
|
||||
|
|
|
@ -20,14 +20,17 @@
|
|||
package org.elasticsearch.repositories.azure;
|
||||
|
||||
import com.microsoft.azure.storage.LocationMode;
|
||||
|
||||
import com.microsoft.azure.storage.StorageException;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.cluster.metadata.RepositoryMetaData;
|
||||
import org.elasticsearch.common.blobstore.BlobContainer;
|
||||
import org.elasticsearch.common.blobstore.BlobMetaData;
|
||||
import org.elasticsearch.common.blobstore.BlobPath;
|
||||
import org.elasticsearch.common.blobstore.BlobStore;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.repositories.azure.AzureRepository.Repository;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
|
@ -36,9 +39,9 @@ import java.util.Map;
|
|||
|
||||
import static java.util.Collections.emptyMap;
|
||||
|
||||
import static org.elasticsearch.repositories.azure.AzureRepository.Repository;
|
||||
|
||||
public class AzureBlobStore extends AbstractComponent implements BlobStore {
|
||||
public class AzureBlobStore implements BlobStore {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(AzureBlobStore.class);
|
||||
|
||||
private final AzureStorageService service;
|
||||
|
||||
|
|
|
@ -34,12 +34,14 @@ import com.microsoft.azure.storage.blob.CloudBlobContainer;
|
|||
import com.microsoft.azure.storage.blob.CloudBlockBlob;
|
||||
import com.microsoft.azure.storage.blob.DeleteSnapshotsOption;
|
||||
import com.microsoft.azure.storage.blob.ListBlobItem;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.elasticsearch.common.blobstore.BlobMetaData;
|
||||
import org.elasticsearch.common.blobstore.support.PlainBlobMetaData;
|
||||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.settings.SettingsException;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
|
@ -58,7 +60,9 @@ import java.util.function.Supplier;
|
|||
|
||||
import static java.util.Collections.emptyMap;
|
||||
|
||||
public class AzureStorageService extends AbstractComponent {
|
||||
public class AzureStorageService {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(AzureStorageService.class);
|
||||
|
||||
public static final ByteSizeValue MIN_CHUNK_SIZE = new ByteSizeValue(1, ByteSizeUnit.BYTES);
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,9 @@ import com.google.cloud.storage.Bucket;
|
|||
import com.google.cloud.storage.Storage;
|
||||
import com.google.cloud.storage.Storage.BlobListOption;
|
||||
import com.google.cloud.storage.StorageException;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.elasticsearch.common.blobstore.BlobContainer;
|
||||
import org.elasticsearch.common.blobstore.BlobMetaData;
|
||||
|
@ -36,7 +39,6 @@ import org.elasticsearch.common.blobstore.BlobStore;
|
|||
import org.elasticsearch.common.blobstore.BlobStoreException;
|
||||
import org.elasticsearch.common.blobstore.support.PlainBlobMetaData;
|
||||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.core.internal.io.Streams;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -56,7 +58,9 @@ import java.util.stream.Collectors;
|
|||
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
|
||||
import static java.net.HttpURLConnection.HTTP_PRECON_FAILED;
|
||||
|
||||
class GoogleCloudStorageBlobStore extends AbstractComponent implements BlobStore {
|
||||
class GoogleCloudStorageBlobStore implements BlobStore {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(GoogleCloudStorageBlobStore.class);
|
||||
|
||||
// The recommended maximum size of a blob that should be uploaded in a single
|
||||
// request. Larger files should be uploaded over multiple requests (this is
|
||||
|
|
|
@ -28,10 +28,11 @@ import com.google.cloud.http.HttpTransportOptions;
|
|||
import com.google.cloud.storage.Storage;
|
||||
import com.google.cloud.storage.StorageOptions;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.LazyInitializable;
|
||||
|
||||
|
@ -45,7 +46,9 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
|
||||
import static java.util.Collections.emptyMap;
|
||||
|
||||
public class GoogleCloudStorageService extends AbstractComponent {
|
||||
public class GoogleCloudStorageService {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(GoogleCloudStorageService.class);
|
||||
|
||||
/**
|
||||
* Dictionary of client instances. Client instances are built lazily from the
|
||||
|
|
|
@ -27,18 +27,18 @@ import com.amazonaws.services.s3.model.HeadBucketRequest;
|
|||
import com.amazonaws.services.s3.model.ObjectListing;
|
||||
import com.amazonaws.services.s3.model.S3ObjectSummary;
|
||||
import com.amazonaws.services.s3.model.StorageClass;
|
||||
|
||||
import org.elasticsearch.common.blobstore.BlobContainer;
|
||||
import org.elasticsearch.common.blobstore.BlobPath;
|
||||
import org.elasticsearch.common.blobstore.BlobStore;
|
||||
import org.elasticsearch.common.blobstore.BlobStoreException;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
class S3BlobStore extends AbstractComponent implements BlobStore {
|
||||
class S3BlobStore implements BlobStore {
|
||||
|
||||
private final S3Service service;
|
||||
|
||||
|
|
|
@ -29,10 +29,11 @@ import com.amazonaws.internal.StaticCredentialsProvider;
|
|||
import com.amazonaws.services.s3.AmazonS3;
|
||||
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
|
||||
import com.amazonaws.services.s3.internal.Constants;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
@ -41,7 +42,9 @@ import java.util.Map;
|
|||
import static java.util.Collections.emptyMap;
|
||||
|
||||
|
||||
class S3Service extends AbstractComponent implements Closeable {
|
||||
class S3Service implements Closeable {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(S3Service.class);
|
||||
|
||||
private volatile Map<String, AmazonS3Reference> clientsCache = emptyMap();
|
||||
private volatile Map<String, S3ClientSettings> clientsSettings = emptyMap();
|
||||
|
|
|
@ -26,6 +26,9 @@ import com.amazonaws.auth.AWSCredentialsProvider;
|
|||
import com.amazonaws.services.s3.AmazonS3;
|
||||
import com.amazonaws.services.s3.model.HeadBucketRequest;
|
||||
import com.amazonaws.services.s3.model.HeadBucketResult;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.cluster.metadata.RepositoryMetaData;
|
||||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.elasticsearch.common.settings.MockSecureSettings;
|
||||
|
@ -68,6 +71,9 @@ public class RepositoryCredentialsTests extends ESTestCase {
|
|||
}
|
||||
|
||||
static final class ProxyS3Service extends S3Service {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(ProxyS3Service.class);
|
||||
|
||||
@Override
|
||||
AmazonS3 buildClient(final S3ClientSettings clientSettings) {
|
||||
final AmazonS3 client = super.buildClient(clientSettings);
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
package org.elasticsearch.indices.cluster;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.ExceptionsHelper;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
|
@ -67,7 +69,6 @@ import org.elasticsearch.cluster.routing.allocation.decider.ReplicaAfterPrimaryA
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.SameShardAllocationDecider;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.UUIDs;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.settings.ClusterSettings;
|
||||
import org.elasticsearch.common.settings.IndexScopedSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -105,11 +106,12 @@ import static org.mockito.Mockito.doAnswer;
|
|||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class ClusterStateChanges extends AbstractComponent {
|
||||
public class ClusterStateChanges {
|
||||
private static final Settings SETTINGS = Settings.builder()
|
||||
.put(PATH_HOME_SETTING.getKey(), "dummy")
|
||||
.build();
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(ClusterStateChanges.class);
|
||||
private final AllocationService allocationService;
|
||||
private final ClusterService clusterService;
|
||||
private final ShardStateAction.ShardFailedClusterStateTaskExecutor shardFailedClusterStateTaskExecutor;
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
*/
|
||||
package org.elasticsearch.test.discovery;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.cluster.ClusterName;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
|
||||
import org.elasticsearch.discovery.zen.PingContextProvider;
|
||||
|
@ -35,7 +36,9 @@ import java.util.function.Consumer;
|
|||
* A {@link ZenPing} implementation which returns results based on a static in-memory map. This allows pinging
|
||||
* to be immediate and can be used to speed up tests.
|
||||
*/
|
||||
public final class MockZenPing extends AbstractComponent implements ZenPing {
|
||||
public final class MockZenPing implements ZenPing {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(MockZenPing.class);
|
||||
|
||||
static final Map<ClusterName, Set<MockZenPing>> activeNodesPerCluster = new HashMap<>();
|
||||
|
||||
|
|
Loading…
Reference in New Issue