From 4d899ccda2849907f7c744c86c9680e8313c7808 Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Mon, 1 Aug 2022 09:27:17 -0700 Subject: [PATCH] Deprecate class FakeThreadPoolMasterService, BlockMasterServiceOnMaster and BusyMasterServiceDisruption (#4058) To support inclusive language, the master terminology is going to be replaced by cluster manager in the code base. In a previous PR https://github.com/opensearch-project/OpenSearch/pull/4051, 3 classes in `test/framework` directory that contains `master` in the name were renamed: ``` FakeThreadPoolMasterService -> FakeThreadPoolClusterManagerService BlockMasterServiceOnMaster -> BlockClusterManagerServiceOnClusterManager BusyMasterServiceDisruption -> BusyClusterManagerServiceDisruption ``` This is a following commit to add back the classes with the old name to keep the backwards compatibility. The classes with the old name will be subclass of the classes with new name, so that maintaining one implementation can support the usage for two classes. Signed-off-by: Tianli Feng (cherry picked from commit cebeb8c9c91366b88596e85b87df6ad5f55fd874) --- .../service/FakeThreadPoolMasterService.java | 28 +++++++++++++++++++ .../BlockMasterServiceOnMaster.java | 21 ++++++++++++++ .../BusyMasterServiceDisruption.java | 23 +++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 test/framework/src/main/java/org/opensearch/cluster/service/FakeThreadPoolMasterService.java create mode 100644 test/framework/src/main/java/org/opensearch/test/disruption/BlockMasterServiceOnMaster.java create mode 100644 test/framework/src/main/java/org/opensearch/test/disruption/BusyMasterServiceDisruption.java diff --git a/test/framework/src/main/java/org/opensearch/cluster/service/FakeThreadPoolMasterService.java b/test/framework/src/main/java/org/opensearch/cluster/service/FakeThreadPoolMasterService.java new file mode 100644 index 0000000000000..0713432c00189 --- /dev/null +++ b/test/framework/src/main/java/org/opensearch/cluster/service/FakeThreadPoolMasterService.java @@ -0,0 +1,28 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.cluster.service; + +import org.opensearch.threadpool.ThreadPool; + +import java.util.function.Consumer; + +/** + * @deprecated As of 2.2, because supporting inclusive language, replaced by {@link FakeThreadPoolClusterManagerService} + */ +@Deprecated +public class FakeThreadPoolMasterService extends FakeThreadPoolClusterManagerService { + public FakeThreadPoolMasterService( + String nodeName, + String serviceName, + ThreadPool threadPool, + Consumer onTaskAvailableToRun + ) { + super(nodeName, serviceName, threadPool, onTaskAvailableToRun); + } +} diff --git a/test/framework/src/main/java/org/opensearch/test/disruption/BlockMasterServiceOnMaster.java b/test/framework/src/main/java/org/opensearch/test/disruption/BlockMasterServiceOnMaster.java new file mode 100644 index 0000000000000..bbe99d838f296 --- /dev/null +++ b/test/framework/src/main/java/org/opensearch/test/disruption/BlockMasterServiceOnMaster.java @@ -0,0 +1,21 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.test.disruption; + +import java.util.Random; + +/** + * @deprecated As of 2.2, because supporting inclusive language, replaced by {@link BlockClusterManagerServiceOnClusterManager} + */ +@Deprecated +public class BlockMasterServiceOnMaster extends BlockClusterManagerServiceOnClusterManager { + public BlockMasterServiceOnMaster(Random random) { + super(random); + } +} diff --git a/test/framework/src/main/java/org/opensearch/test/disruption/BusyMasterServiceDisruption.java b/test/framework/src/main/java/org/opensearch/test/disruption/BusyMasterServiceDisruption.java new file mode 100644 index 0000000000000..884997123e6a4 --- /dev/null +++ b/test/framework/src/main/java/org/opensearch/test/disruption/BusyMasterServiceDisruption.java @@ -0,0 +1,23 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.test.disruption; + +import org.opensearch.common.Priority; + +import java.util.Random; + +/** + * @deprecated As of 2.2, because supporting inclusive language, replaced by {@link BusyClusterManagerServiceDisruption} + */ +@Deprecated +public class BusyMasterServiceDisruption extends BusyClusterManagerServiceDisruption { + public BusyMasterServiceDisruption(Random random, Priority priority) { + super(random, priority); + } +}