diff --git a/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3AsyncService.java b/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3AsyncService.java index d8b88956ee27e..653034ee9afde 100644 --- a/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3AsyncService.java +++ b/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3AsyncService.java @@ -17,7 +17,7 @@ import org.opensearch.common.settings.Settings; import org.opensearch.core.common.Strings; import org.opensearch.repositories.s3.S3ClientSettings.IrsaCredentials; -import org.opensearch.repositories.s3.async.AsyncExecutorBuilder; +import org.opensearch.repositories.s3.async.AsyncExecutorContainer; import org.opensearch.repositories.s3.async.AsyncTransferEventLoopGroup; import software.amazon.awssdk.auth.credentials.AwsCredentials; import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; @@ -102,8 +102,8 @@ public synchronized void refreshAndClearCache(Map clie */ public AmazonAsyncS3Reference client( RepositoryMetadata repositoryMetadata, - AsyncExecutorBuilder priorityExecutorBuilder, - AsyncExecutorBuilder normalExecutorBuilder + AsyncExecutorContainer priorityExecutorBuilder, + AsyncExecutorContainer normalExecutorBuilder ) { final S3ClientSettings clientSettings = settings(repositoryMetadata); { @@ -164,8 +164,8 @@ S3ClientSettings settings(RepositoryMetadata repositoryMetadata) { // proxy for testing synchronized AmazonAsyncS3WithCredentials buildClient( final S3ClientSettings clientSettings, - AsyncExecutorBuilder priorityExecutorBuilder, - AsyncExecutorBuilder normalExecutorBuilder + AsyncExecutorContainer priorityExecutorBuilder, + AsyncExecutorContainer normalExecutorBuilder ) { setDefaultAwsProfilePath(); final S3AsyncClientBuilder builder = S3AsyncClient.builder(); diff --git a/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/async/AsyncExecutorBuilder.java b/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/async/AsyncExecutorContainer.java similarity index 96% rename from plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/async/AsyncExecutorBuilder.java rename to plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/async/AsyncExecutorContainer.java index f43e55a428fce..1ae1a15ad4010 100644 --- a/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/async/AsyncExecutorBuilder.java +++ b/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/async/AsyncExecutorContainer.java @@ -13,7 +13,7 @@ /** * An encapsulation for the {@link AsyncTransferEventLoopGroup}, and the stream reader and future completion executor services */ -public class AsyncExecutorBuilder { +public class AsyncExecutorContainer { private final ExecutorService futureCompletionExecutor; private final ExecutorService streamReader; @@ -26,7 +26,7 @@ public class AsyncExecutorBuilder { * @param streamReader An {@link ExecutorService} to read streams for upload * @param asyncTransferEventLoopGroup A {@link AsyncTransferEventLoopGroup} which encapsulates the netty {@link io.netty.channel.EventLoopGroup} for async uploads */ - public AsyncExecutorBuilder( + public AsyncExecutorContainer( ExecutorService futureCompletionExecutor, ExecutorService streamReader, AsyncTransferEventLoopGroup asyncTransferEventLoopGroup diff --git a/plugins/repository-s3/src/test/java/org/opensearch/repositories/s3/S3AsyncServiceTests.java b/plugins/repository-s3/src/test/java/org/opensearch/repositories/s3/S3AsyncServiceTests.java index 8d410fc8dc56c..a401ba06728d7 100644 --- a/plugins/repository-s3/src/test/java/org/opensearch/repositories/s3/S3AsyncServiceTests.java +++ b/plugins/repository-s3/src/test/java/org/opensearch/repositories/s3/S3AsyncServiceTests.java @@ -13,7 +13,7 @@ import org.opensearch.cluster.metadata.RepositoryMetadata; import org.opensearch.common.settings.MockSecureSettings; import org.opensearch.common.settings.Settings; -import org.opensearch.repositories.s3.async.AsyncExecutorBuilder; +import org.opensearch.repositories.s3.async.AsyncExecutorContainer; import org.opensearch.repositories.s3.async.AsyncTransferEventLoopGroup; import org.opensearch.test.OpenSearchTestCase; @@ -35,7 +35,7 @@ public void testCachedClientsAreReleased() { final Settings settings = Settings.builder().put("endpoint", "http://first").put("region", "us-east-2").build(); final RepositoryMetadata metadata1 = new RepositoryMetadata("first", "s3", settings); final RepositoryMetadata metadata2 = new RepositoryMetadata("second", "s3", settings); - final AsyncExecutorBuilder asyncExecutorBuilder = new AsyncExecutorBuilder( + final AsyncExecutorContainer asyncExecutorContainer = new AsyncExecutorContainer( Executors.newSingleThreadExecutor(), Executors.newSingleThreadExecutor(), new AsyncTransferEventLoopGroup(1) @@ -44,12 +44,12 @@ public void testCachedClientsAreReleased() { final S3ClientSettings otherClientSettings = s3AsyncService.settings(metadata2); assertSame(clientSettings, otherClientSettings); final AmazonAsyncS3Reference reference = SocketAccess.doPrivileged( - () -> s3AsyncService.client(metadata1, asyncExecutorBuilder, asyncExecutorBuilder) + () -> s3AsyncService.client(metadata1, asyncExecutorContainer, asyncExecutorContainer) ); reference.close(); s3AsyncService.close(); final AmazonAsyncS3Reference referenceReloaded = SocketAccess.doPrivileged( - () -> s3AsyncService.client(metadata1, asyncExecutorBuilder, asyncExecutorBuilder) + () -> s3AsyncService.client(metadata1, asyncExecutorContainer, asyncExecutorContainer) ); assertNotSame(referenceReloaded, reference); referenceReloaded.close(); @@ -70,7 +70,7 @@ public void testCachedClientsWithCredentialsAreReleased() { final Settings settings = Settings.builder().put("endpoint", "http://first").put("region", "us-east-2").build(); final RepositoryMetadata metadata1 = new RepositoryMetadata("first", "s3", settings); final RepositoryMetadata metadata2 = new RepositoryMetadata("second", "s3", settings); - final AsyncExecutorBuilder asyncExecutorBuilder = new AsyncExecutorBuilder( + final AsyncExecutorContainer asyncExecutorContainer = new AsyncExecutorContainer( Executors.newSingleThreadExecutor(), Executors.newSingleThreadExecutor(), new AsyncTransferEventLoopGroup(1) @@ -79,12 +79,12 @@ public void testCachedClientsWithCredentialsAreReleased() { final S3ClientSettings otherClientSettings = s3AsyncService.settings(metadata2); assertSame(clientSettings, otherClientSettings); final AmazonAsyncS3Reference reference = SocketAccess.doPrivileged( - () -> s3AsyncService.client(metadata1, asyncExecutorBuilder, asyncExecutorBuilder) + () -> s3AsyncService.client(metadata1, asyncExecutorContainer, asyncExecutorContainer) ); reference.close(); s3AsyncService.close(); final AmazonAsyncS3Reference referenceReloaded = SocketAccess.doPrivileged( - () -> s3AsyncService.client(metadata1, asyncExecutorBuilder, asyncExecutorBuilder) + () -> s3AsyncService.client(metadata1, asyncExecutorContainer, asyncExecutorContainer) ); assertNotSame(referenceReloaded, reference); referenceReloaded.close();