From 4eefc09d90bd2f5ca7de4c7fd0f19a48114d3166 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Sat, 7 Jan 2023 22:57:19 +0800 Subject: [PATCH] Rename PluginBootService to PluginLifecycleService (#23396) * Refactor PluginBootServiceManager * Refactor PluginLifecycleServiceManager * Refactor PluginLifecycleServiceManager * Rename PluginBootService to PluginLifecycleService --- agent/README.md | 4 +- ...rvice.java => PluginLifecycleService.java} | 6 +- .../agent/core/builder/AgentTransformer.java | 18 ++---- .../builder/{ => advisor}/AdviceFactory.java | 2 +- .../builder/{ => advisor}/MethodAdvisor.java | 2 +- .../{ => advisor}/MethodAdvisorBuilder.java | 2 +- ...ava => PluginLifecycleServiceManager.java} | 44 ++++++++------ ...=> FileLoggingPluginLifecycleService.java} | 6 +- ...ngsphere.agent.spi.PluginLifecycleService} | 2 +- ... => PrometheusPluginLifecycleService.java} | 6 +- ...ngsphere.agent.spi.PluginLifecycleService} | 2 +- ...PrometheusPluginLifecycleServiceTest.java} | 8 +-- ... JaegerTracingPluginLifecycleService.java} | 6 +- ...ngsphere.agent.spi.PluginLifecycleService} | 2 +- ...gerTracingPluginLifecycleServiceTest.java} | 8 +-- ...lemetryTracingPluginLifecycleService.java} | 7 ++- ...ngsphere.agent.spi.PluginLifecycleService} | 2 +- ...tryTracingPluginLifecycleServiceTest.java} | 18 +++--- ...=> OpenTracingPluginLifecycleService.java} | 6 +- ...ngsphere.agent.spi.PluginLifecycleService} | 2 +- ...penTracingPluginLifecycleServiceTest.java} | 8 +-- ... ZipkinTracingPluginLifecycleService.java} | 6 +- ...ngsphere.agent.spi.PluginLifecycleService} | 2 +- ...kinTracingPluginLifecycleServiceTest.java} | 10 ++-- docs/document/content/dev-manual/agent.cn.md | 22 +++---- docs/document/content/dev-manual/agent.en.md | 22 +++---- .../content/dev-manual/sharding.cn.md | 60 +++++++++---------- .../content/dev-manual/sharding.en.md | 6 +- 28 files changed, 145 insertions(+), 144 deletions(-) rename agent/api/src/main/java/org/apache/shardingsphere/agent/spi/{PluginBootService.java => PluginLifecycleService.java} (87%) rename agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/{ => advisor}/AdviceFactory.java (97%) rename agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/{ => advisor}/MethodAdvisor.java (95%) rename agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/{ => advisor}/MethodAdvisorBuilder.java (98%) rename agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/{PluginBootServiceManager.java => PluginLifecycleServiceManager.java} (63%) rename agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/{FileLoggingPluginBootService.java => FileLoggingPluginLifecycleService.java} (85%) rename agent/plugins/logging/type/file/src/main/resources/META-INF/services/{org.apache.shardingsphere.agent.spi.PluginBootService => org.apache.shardingsphere.agent.spi.PluginLifecycleService} (97%) rename agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/{PrometheusPluginBootService.java => PrometheusPluginLifecycleService.java} (95%) rename agent/plugins/metrics/type/prometheus/src/main/resources/META-INF/services/{org.apache.shardingsphere.agent.spi.PluginBootService => org.apache.shardingsphere.agent.spi.PluginLifecycleService} (96%) rename agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/{PrometheusPluginBootServiceTest.java => PrometheusPluginLifecycleServiceTest.java} (86%) rename agent/plugins/tracing/type/jaeger/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/{JaegerTracingPluginBootService.java => JaegerTracingPluginLifecycleService.java} (93%) rename agent/plugins/tracing/type/jaeger/src/main/resources/META-INF/services/{org.apache.shardingsphere.agent.spi.PluginBootService => org.apache.shardingsphere.agent.spi.PluginLifecycleService} (97%) rename agent/plugins/tracing/type/jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/{JaegerTracingPluginBootServiceTest.java => JaegerTracingPluginLifecycleServiceTest.java} (86%) rename agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/{OpenTelemetryTracingPluginBootService.java => OpenTelemetryTracingPluginLifecycleService.java} (89%) rename agent/plugins/tracing/type/opentelemetry/src/main/resources/META-INF/services/{org.apache.shardingsphere.agent.spi.PluginBootService => org.apache.shardingsphere.agent.spi.PluginLifecycleService} (95%) rename agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/{OpenTelemetryTracingPluginBootServiceTest.java => OpenTelemetryTracingPluginLifecycleServiceTest.java} (84%) rename agent/plugins/tracing/type/opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/{OpenTracingPluginBootService.java => OpenTracingPluginLifecycleService.java} (91%) rename agent/plugins/tracing/type/opentracing/src/main/resources/META-INF/services/{org.apache.shardingsphere.agent.spi.PluginBootService => org.apache.shardingsphere.agent.spi.PluginLifecycleService} (96%) rename agent/plugins/tracing/type/opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/{OpenTracingPluginBootServiceTest.java => OpenTracingPluginLifecycleServiceTest.java} (76%) rename agent/plugins/tracing/type/zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/{ZipkinTracingPluginBootService.java => ZipkinTracingPluginLifecycleService.java} (95%) rename agent/plugins/tracing/type/zipkin/src/main/resources/META-INF/services/{org.apache.shardingsphere.agent.spi.PluginBootService => org.apache.shardingsphere.agent.spi.PluginLifecycleService} (97%) rename agent/plugins/tracing/type/zipkin/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/{ZipkinTracingPluginBootServiceTest.java => ZipkinTracingPluginLifecycleServiceTest.java} (76%) diff --git a/agent/README.md b/agent/README.md index dbdd1b048c21a..3e76f5ca01a36 100644 --- a/agent/README.md +++ b/agent/README.md @@ -57,9 +57,9 @@ java -javaagent:/xx/xx/shardingsphere-agent-{latest.release.version}.jar -jar pr * `lib` contains dependencies common to plugins. * `plugins` contains all plugins. -### Extend via SPI PluginBootService +### Extend via SPI PluginLifecycleService -`PluginBootService` is the plugin service definition interface, used to start the plugin service. +`PluginLifecycleService` is the plugin service definition interface, used to start the plugin service. Custom plugins need to implement this interface. ### Configure advisors.yaml diff --git a/agent/api/src/main/java/org/apache/shardingsphere/agent/spi/PluginBootService.java b/agent/api/src/main/java/org/apache/shardingsphere/agent/spi/PluginLifecycleService.java similarity index 87% rename from agent/api/src/main/java/org/apache/shardingsphere/agent/spi/PluginBootService.java rename to agent/api/src/main/java/org/apache/shardingsphere/agent/spi/PluginLifecycleService.java index 8d2f4f74225d1..aae6c0acfa90e 100644 --- a/agent/api/src/main/java/org/apache/shardingsphere/agent/spi/PluginBootService.java +++ b/agent/api/src/main/java/org/apache/shardingsphere/agent/spi/PluginLifecycleService.java @@ -20,12 +20,12 @@ import org.apache.shardingsphere.agent.api.PluginConfiguration; /** - * Plugin boot service that the lifecycle is from the agent start to shutdown. + * Plugin lifecycle service. */ -public interface PluginBootService extends AutoCloseable { +public interface PluginLifecycleService extends AutoCloseable { /** - * Start plugin boot service. + * Start plugin. * * @param pluginConfig plugin configuration * @param isEnhancedForProxy is enhanced for proxy diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentTransformer.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentTransformer.java index 9f555d9f02907..7099231d96d5f 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentTransformer.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AgentTransformer.java @@ -24,16 +24,17 @@ import net.bytebuddy.implementation.FieldAccessor; import net.bytebuddy.jar.asm.Opcodes; import net.bytebuddy.utility.JavaModule; +import org.apache.shardingsphere.agent.api.PluginConfiguration; import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject; +import org.apache.shardingsphere.agent.core.builder.advisor.AdviceFactory; +import org.apache.shardingsphere.agent.core.builder.advisor.MethodAdvisorBuilder; import org.apache.shardingsphere.agent.core.classloader.ClassLoaderContext; -import org.apache.shardingsphere.agent.core.plugin.PluginBootServiceManager; import org.apache.shardingsphere.agent.core.plugin.PluginJar; +import org.apache.shardingsphere.agent.core.plugin.PluginLifecycleServiceManager; import org.apache.shardingsphere.agent.core.plugin.advisor.AdvisorConfiguration; -import org.apache.shardingsphere.agent.api.PluginConfiguration; import java.util.Collection; import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; /** * Agent transformer. @@ -43,8 +44,6 @@ public final class AgentTransformer implements Transformer { private static final String EXTRA_DATA = "_$EXTRA_DATA$_"; - private static final AtomicBoolean STARTED_FLAG = new AtomicBoolean(false); - private final Map pluginConfigs; private final Collection pluginJars; @@ -60,16 +59,9 @@ public Builder transform(final Builder builder, final TypeDescription type return builder; } ClassLoaderContext classLoaderContext = new ClassLoaderContext(classLoader, pluginJars); - startAllServices(classLoaderContext.getAgentClassLoader()); + PluginLifecycleServiceManager.init(pluginConfigs, pluginJars, classLoaderContext.getAgentClassLoader(), isEnhancedForProxy); Builder targetAdviceObjectBuilder = builder.defineField(EXTRA_DATA, Object.class, Opcodes.ACC_PRIVATE | Opcodes.ACC_VOLATILE).implement(TargetAdviceObject.class).intercept(FieldAccessor.ofField(EXTRA_DATA)); return new MethodAdvisorBuilder(new AdviceFactory(classLoaderContext), advisorConfigs.get(typeDescription.getTypeName()), typeDescription).build(targetAdviceObjectBuilder); } - - private void startAllServices(final ClassLoader agentClassLoader) { - if (STARTED_FLAG.compareAndSet(false, true)) { - PluginBootServiceManager.startAllServices(pluginConfigs, agentClassLoader, isEnhancedForProxy); - Runtime.getRuntime().addShutdownHook(new Thread(() -> PluginBootServiceManager.closeAllServices(pluginJars))); - } - } } diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AdviceFactory.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/advisor/AdviceFactory.java similarity index 97% rename from agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AdviceFactory.java rename to agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/advisor/AdviceFactory.java index f893100fa0c40..2f109257ffc68 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/AdviceFactory.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/advisor/AdviceFactory.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.agent.core.builder; +package org.apache.shardingsphere.agent.core.builder.advisor; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/MethodAdvisor.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/advisor/MethodAdvisor.java similarity index 95% rename from agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/MethodAdvisor.java rename to agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/advisor/MethodAdvisor.java index 53f6525d85b67..f146b1abf875d 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/MethodAdvisor.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/advisor/MethodAdvisor.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.agent.core.builder; +package org.apache.shardingsphere.agent.core.builder.advisor; import lombok.Getter; import lombok.RequiredArgsConstructor; diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/MethodAdvisorBuilder.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/advisor/MethodAdvisorBuilder.java similarity index 98% rename from agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/MethodAdvisorBuilder.java rename to agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/advisor/MethodAdvisorBuilder.java index cb34605181128..db48bdbf68054 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/MethodAdvisorBuilder.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/builder/advisor/MethodAdvisorBuilder.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.agent.core.builder; +package org.apache.shardingsphere.agent.core.builder.advisor; import lombok.RequiredArgsConstructor; import net.bytebuddy.description.method.MethodDescription.InDefinedShape; diff --git a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginBootServiceManager.java b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManager.java similarity index 63% rename from agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginBootServiceManager.java rename to agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManager.java index 80ddeafb03eb6..2dc5e1bb0a7c5 100644 --- a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginBootServiceManager.java +++ b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/plugin/PluginLifecycleServiceManager.java @@ -23,45 +23,56 @@ import org.apache.shardingsphere.agent.core.log.LoggerFactory; import org.apache.shardingsphere.agent.core.log.LoggerFactory.Logger; import org.apache.shardingsphere.agent.core.spi.AgentServiceLoader; -import org.apache.shardingsphere.agent.spi.PluginBootService; +import org.apache.shardingsphere.agent.spi.PluginLifecycleService; import java.io.IOException; import java.util.Collection; import java.util.Map; import java.util.Map.Entry; +import java.util.concurrent.atomic.AtomicBoolean; /** - * Plugin boot service manager. + * Plugin lifecycle service manager. */ @NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class PluginBootServiceManager { +public final class PluginLifecycleServiceManager { - private static final Logger LOGGER = LoggerFactory.getLogger(PluginBootServiceManager.class); + private static final AtomicBoolean STARTED_FLAG = new AtomicBoolean(false); + + private static final Logger LOGGER = LoggerFactory.getLogger(PluginLifecycleServiceManager.class); /** - * Start all services. - * + * Initialize all plugins. + * * @param pluginConfigs plugin configuration map + * @param pluginJars plugin jars * @param agentClassLoader agent class loader * @param isEnhancedForProxy is enhanced for proxy */ - public static void startAllServices(final Map pluginConfigs, final ClassLoader agentClassLoader, final boolean isEnhancedForProxy) { + public static void init(final Map pluginConfigs, final Collection pluginJars, final ClassLoader agentClassLoader, final boolean isEnhancedForProxy) { + if (STARTED_FLAG.compareAndSet(false, true)) { + PluginLifecycleServiceManager.start(pluginConfigs, agentClassLoader, isEnhancedForProxy); + Runtime.getRuntime().addShutdownHook(new Thread(() -> PluginLifecycleServiceManager.close(pluginJars))); + } + } + + private static void start(final Map pluginConfigs, final ClassLoader agentClassLoader, final boolean isEnhancedForProxy) { ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(agentClassLoader); for (Entry entry : pluginConfigs.entrySet()) { - AgentServiceLoader.getServiceLoader(PluginBootService.class).getServices() - .stream().filter(each -> each.getType().equalsIgnoreCase(entry.getKey())).findFirst().ifPresent(optional -> startService(entry.getValue(), optional, isEnhancedForProxy)); + AgentServiceLoader.getServiceLoader(PluginLifecycleService.class).getServices() + .stream().filter(each -> each.getType().equalsIgnoreCase(entry.getKey())).findFirst().ifPresent(optional -> start(entry.getValue(), optional, isEnhancedForProxy)); } } finally { Thread.currentThread().setContextClassLoader(originalClassLoader); } } - private static void startService(final PluginConfiguration pluginConfig, final PluginBootService pluginBootService, final boolean isEnhancedForProxy) { + private static void start(final PluginConfiguration pluginConfig, final PluginLifecycleService pluginLifecycleService, final boolean isEnhancedForProxy) { try { - LOGGER.info("Start plugin: {}", pluginBootService.getType()); - pluginBootService.start(pluginConfig, isEnhancedForProxy); + LOGGER.info("Start plugin: {}", pluginLifecycleService.getType()); + pluginLifecycleService.start(pluginConfig, isEnhancedForProxy); // CHECKSTYLE:OFF } catch (final Throwable ex) { // CHECKSTYLE:ON @@ -69,13 +80,8 @@ private static void startService(final PluginConfiguration pluginConfig, final P } } - /** - * Close all services. - * - * @param pluginJars plugin jars - */ - public static void closeAllServices(final Collection pluginJars) { - AgentServiceLoader.getServiceLoader(PluginBootService.class).getServices().forEach(each -> { + private static void close(final Collection pluginJars) { + AgentServiceLoader.getServiceLoader(PluginLifecycleService.class).getServices().forEach(each -> { try { each.close(); // CHECKSTYLE:OFF diff --git a/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginBootService.java b/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginLifecycleService.java similarity index 85% rename from agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginBootService.java rename to agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginLifecycleService.java index 581d8cff7b551..e50c3ce309c1f 100644 --- a/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginBootService.java +++ b/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginLifecycleService.java @@ -18,12 +18,12 @@ package org.apache.shardingsphere.agent.plugin.logging.file; import org.apache.shardingsphere.agent.api.PluginConfiguration; -import org.apache.shardingsphere.agent.spi.PluginBootService; +import org.apache.shardingsphere.agent.spi.PluginLifecycleService; /** - * File logging plugin boot service. + * File logging plugin lifecycle service. */ -public final class FileLoggingPluginBootService implements PluginBootService { +public final class FileLoggingPluginLifecycleService implements PluginLifecycleService { @Override public void start(final PluginConfiguration pluginConfig, final boolean isEnhancedForProxy) { diff --git a/agent/plugins/logging/type/file/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService b/agent/plugins/logging/type/file/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService similarity index 97% rename from agent/plugins/logging/type/file/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService rename to agent/plugins/logging/type/file/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService index 42e8c971aae87..d829b56483b26 100644 --- a/agent/plugins/logging/type/file/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService +++ b/agent/plugins/logging/type/file/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService @@ -15,4 +15,4 @@ # limitations under the License. # -org.apache.shardingsphere.agent.plugin.logging.file.FileLoggingPluginBootService +org.apache.shardingsphere.agent.plugin.logging.file.FileLoggingPluginLifecycleService diff --git a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginBootService.java b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java similarity index 95% rename from agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginBootService.java rename to agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java index 3fb9b776edee9..ce5595b1310e3 100644 --- a/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginBootService.java +++ b/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java @@ -29,16 +29,16 @@ import org.apache.shardingsphere.agent.plugin.metrics.prometheus.collector.ProxyInfoCollector; import org.apache.shardingsphere.agent.plugin.metrics.prometheus.wrapper.PrometheusWrapperFactory; import org.apache.shardingsphere.agent.plugin.core.config.validator.PluginConfigurationValidator; -import org.apache.shardingsphere.agent.spi.PluginBootService; +import org.apache.shardingsphere.agent.spi.PluginLifecycleService; import java.io.IOException; import java.net.InetSocketAddress; /** - * Prometheus plugin boot service. + * Prometheus plugin lifecycle service. */ @Slf4j -public final class PrometheusPluginBootService implements PluginBootService { +public final class PrometheusPluginLifecycleService implements PluginLifecycleService { private static final String KEY_JVM_INFORMATION_COLLECTOR_ENABLED = "jvm-information-collector-enabled"; diff --git a/agent/plugins/metrics/type/prometheus/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService b/agent/plugins/metrics/type/prometheus/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService similarity index 96% rename from agent/plugins/metrics/type/prometheus/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService rename to agent/plugins/metrics/type/prometheus/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService index 00624d3151fbf..74bb700e620a0 100644 --- a/agent/plugins/metrics/type/prometheus/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService +++ b/agent/plugins/metrics/type/prometheus/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService @@ -15,4 +15,4 @@ # limitations under the License. # -org.apache.shardingsphere.agent.plugin.metrics.prometheus.PrometheusPluginBootService +org.apache.shardingsphere.agent.plugin.metrics.prometheus.PrometheusPluginLifecycleService diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginBootServiceTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java similarity index 86% rename from agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginBootServiceTest.java rename to agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java index 8e9304eee2b4c..e894b2adc27a1 100644 --- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginBootServiceTest.java +++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleServiceTest.java @@ -42,13 +42,13 @@ import static org.mockito.Mockito.mock; -public final class PrometheusPluginBootServiceTest extends ProxyContextRestorer { +public final class PrometheusPluginLifecycleServiceTest extends ProxyContextRestorer { - private final PrometheusPluginBootService pluginBootService = new PrometheusPluginBootService(); + private final PrometheusPluginLifecycleService pluginLifecycleService = new PrometheusPluginLifecycleService(); @After public void close() { - pluginBootService.close(); + pluginLifecycleService.close(); } @Test @@ -58,7 +58,7 @@ public void assertStart() throws IOException { new ComputeNodeInstance(mock(InstanceMetaData.class)), new StandaloneWorkerIdGenerator(), new ModeConfiguration("Standalone", null), mock(ModeContextManager.class), mock(LockContext.class), new EventBusContext()); ProxyContext.init(new ContextManager(metaDataContexts, instanceContext)); - pluginBootService.start(new PluginConfiguration("localhost", 8090, "", PropertiesBuilder.build(new Property("JVM_INFORMATION_COLLECTOR_ENABLED", Boolean.TRUE.toString()))), true); + pluginLifecycleService.start(new PluginConfiguration("localhost", 8090, "", PropertiesBuilder.build(new Property("JVM_INFORMATION_COLLECTOR_ENABLED", Boolean.TRUE.toString()))), true); new Socket().connect(new InetSocketAddress("localhost", 8090)); } } diff --git a/agent/plugins/tracing/type/jaeger/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginBootService.java b/agent/plugins/tracing/type/jaeger/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginLifecycleService.java similarity index 93% rename from agent/plugins/tracing/type/jaeger/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginBootService.java rename to agent/plugins/tracing/type/jaeger/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginLifecycleService.java index f129ae14d1a62..271cb0dc14b97 100644 --- a/agent/plugins/tracing/type/jaeger/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginBootService.java +++ b/agent/plugins/tracing/type/jaeger/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginLifecycleService.java @@ -21,14 +21,14 @@ import io.opentracing.util.GlobalTracer; import org.apache.shardingsphere.agent.api.PluginConfiguration; import org.apache.shardingsphere.agent.plugin.core.config.validator.PluginConfigurationValidator; -import org.apache.shardingsphere.agent.spi.PluginBootService; +import org.apache.shardingsphere.agent.spi.PluginLifecycleService; import java.util.Optional; /** - * Jaeger tracing plugin boot service. + * Jaeger tracing plugin lifecycle service. */ -public final class JaegerTracingPluginBootService implements PluginBootService { +public final class JaegerTracingPluginLifecycleService implements PluginLifecycleService { private static final String DEFAULT_SERVICE_NAME = "shardingsphere"; diff --git a/agent/plugins/tracing/type/jaeger/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService b/agent/plugins/tracing/type/jaeger/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService similarity index 97% rename from agent/plugins/tracing/type/jaeger/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService rename to agent/plugins/tracing/type/jaeger/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService index d3863fdf342a7..53ed5c307e0c8 100644 --- a/agent/plugins/tracing/type/jaeger/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService +++ b/agent/plugins/tracing/type/jaeger/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService @@ -15,4 +15,4 @@ # limitations under the License. # -org.apache.shardingsphere.agent.plugin.tracing.jaeger.JaegerTracingPluginBootService +org.apache.shardingsphere.agent.plugin.tracing.jaeger.JaegerTracingPluginLifecycleService diff --git a/agent/plugins/tracing/type/jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginBootServiceTest.java b/agent/plugins/tracing/type/jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginLifecycleServiceTest.java similarity index 86% rename from agent/plugins/tracing/type/jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginBootServiceTest.java rename to agent/plugins/tracing/type/jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginLifecycleServiceTest.java index 739c4af40a751..e839ec6032e8e 100644 --- a/agent/plugins/tracing/type/jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginBootServiceTest.java +++ b/agent/plugins/tracing/type/jaeger/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginLifecycleServiceTest.java @@ -30,13 +30,13 @@ import static org.junit.Assert.assertTrue; -public final class JaegerTracingPluginBootServiceTest { +public final class JaegerTracingPluginLifecycleServiceTest { - private final JaegerTracingPluginBootService pluginBootService = new JaegerTracingPluginBootService(); + private final JaegerTracingPluginLifecycleService pluginLifecycleService = new JaegerTracingPluginLifecycleService(); @After public void close() throws ReflectiveOperationException { - pluginBootService.close(); + pluginLifecycleService.close(); Plugins.getMemberAccessor().set(GlobalTracer.class.getDeclaredField("tracer"), GlobalTracer.class, NoopTracerFactory.create()); } @@ -47,7 +47,7 @@ public void assertStart() { new Property("JAEGER_SAMPLER_PARAM", "1"), new Property("JAEGER_REPORTER_LOG_SPANS", Boolean.TRUE.toString()), new Property("JAEGER_REPORTER_FLUSH_INTERVAL", "1")); - pluginBootService.start(new PluginConfiguration("localhost", 5775, "", props), true); + pluginLifecycleService.start(new PluginConfiguration("localhost", 5775, "", props), true); assertTrue(GlobalTracer.isRegistered()); } } diff --git a/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginBootService.java b/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginLifecycleService.java similarity index 89% rename from agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginBootService.java rename to agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginLifecycleService.java index 3702316394da4..9d9683332f56d 100644 --- a/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginBootService.java +++ b/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginLifecycleService.java @@ -20,9 +20,12 @@ import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.autoconfigure.OpenTelemetrySdkAutoConfiguration; import org.apache.shardingsphere.agent.api.PluginConfiguration; -import org.apache.shardingsphere.agent.spi.PluginBootService; +import org.apache.shardingsphere.agent.spi.PluginLifecycleService; -public class OpenTelemetryTracingPluginBootService implements PluginBootService { +/** + * Open telemetry tracing plugin lifecycle service. + */ +public class OpenTelemetryTracingPluginLifecycleService implements PluginLifecycleService { @Override public void start(final PluginConfiguration pluginConfig, final boolean isEnhancedForProxy) { diff --git a/agent/plugins/tracing/type/opentelemetry/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService b/agent/plugins/tracing/type/opentelemetry/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService similarity index 95% rename from agent/plugins/tracing/type/opentelemetry/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService rename to agent/plugins/tracing/type/opentelemetry/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService index 0919840fa37eb..61cd1e64a333d 100644 --- a/agent/plugins/tracing/type/opentelemetry/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService +++ b/agent/plugins/tracing/type/opentelemetry/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService @@ -15,4 +15,4 @@ # limitations under the License. # -org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.OpenTelemetryTracingPluginBootService +org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.OpenTelemetryTracingPluginLifecycleService diff --git a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginBootServiceTest.java b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginLifecycleServiceTest.java similarity index 84% rename from agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginBootServiceTest.java rename to agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginLifecycleServiceTest.java index cbf61baa1bee8..a189728e65431 100644 --- a/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginBootServiceTest.java +++ b/agent/plugins/tracing/type/opentelemetry/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginLifecycleServiceTest.java @@ -26,21 +26,21 @@ import static org.junit.Assert.assertNotNull; -public final class OpenTelemetryTracingPluginBootServiceTest { +public final class OpenTelemetryTracingPluginLifecycleServiceTest { - private final OpenTelemetryTracingPluginBootService pluginBootService = new OpenTelemetryTracingPluginBootService(); - - @After - public void close() { - pluginBootService.close(); - GlobalOpenTelemetry.resetForTest(); - } + private final OpenTelemetryTracingPluginLifecycleService pluginLifecycleService = new OpenTelemetryTracingPluginLifecycleService(); @Test public void assertStart() { - pluginBootService.start(new PluginConfiguration(null, 0, null, + pluginLifecycleService.start(new PluginConfiguration(null, 0, null, PropertiesBuilder.build(new Property("otel.resource.attributes", "service.name=shardingsphere-agent"), new Property("otel.traces.exporter", "zipkin"))), true); assertNotNull(GlobalOpenTelemetry.getTracerProvider()); assertNotNull(GlobalOpenTelemetry.getTracer("shardingsphere-agent")); } + + @After + public void close() { + pluginLifecycleService.close(); + GlobalOpenTelemetry.resetForTest(); + } } diff --git a/agent/plugins/tracing/type/opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginBootService.java b/agent/plugins/tracing/type/opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginLifecycleService.java similarity index 91% rename from agent/plugins/tracing/type/opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginBootService.java rename to agent/plugins/tracing/type/opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginLifecycleService.java index 9191283b7c262..2b1ba77bb1c4f 100644 --- a/agent/plugins/tracing/type/opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginBootService.java +++ b/agent/plugins/tracing/type/opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginLifecycleService.java @@ -21,12 +21,12 @@ import io.opentracing.Tracer; import io.opentracing.util.GlobalTracer; import org.apache.shardingsphere.agent.api.PluginConfiguration; -import org.apache.shardingsphere.agent.spi.PluginBootService; +import org.apache.shardingsphere.agent.spi.PluginLifecycleService; /** - * Open tracing plugin boot service. + * Open tracing plugin lifecycle service. */ -public final class OpenTracingPluginBootService implements PluginBootService { +public final class OpenTracingPluginLifecycleService implements PluginLifecycleService { private static final String KEY_OPENTRACING_TRACER_CLASS_NAME = "opentracing-tracer-class-name"; diff --git a/agent/plugins/tracing/type/opentracing/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService b/agent/plugins/tracing/type/opentracing/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService similarity index 96% rename from agent/plugins/tracing/type/opentracing/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService rename to agent/plugins/tracing/type/opentracing/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService index 0c37008387542..ad23bc65f4a2d 100644 --- a/agent/plugins/tracing/type/opentracing/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService +++ b/agent/plugins/tracing/type/opentracing/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService @@ -15,4 +15,4 @@ # limitations under the License. # -org.apache.shardingsphere.agent.plugin.tracing.opentracing.OpenTracingPluginBootService +org.apache.shardingsphere.agent.plugin.tracing.opentracing.OpenTracingPluginLifecycleService diff --git a/agent/plugins/tracing/type/opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginBootServiceTest.java b/agent/plugins/tracing/type/opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginLifecycleServiceTest.java similarity index 76% rename from agent/plugins/tracing/type/opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginBootServiceTest.java rename to agent/plugins/tracing/type/opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginLifecycleServiceTest.java index 887c2526cf174..05cda4a398be0 100644 --- a/agent/plugins/tracing/type/opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginBootServiceTest.java +++ b/agent/plugins/tracing/type/opentracing/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginLifecycleServiceTest.java @@ -26,18 +26,18 @@ import static org.junit.Assert.assertTrue; -public final class OpenTracingPluginBootServiceTest { +public final class OpenTracingPluginLifecycleServiceTest { - private final OpenTracingPluginBootService pluginBootService = new OpenTracingPluginBootService(); + private final OpenTracingPluginLifecycleService pluginLifecycleService = new OpenTracingPluginLifecycleService(); @After public void close() { - pluginBootService.close(); + pluginLifecycleService.close(); } @Test public void assertStart() { - pluginBootService.start(new PluginConfiguration("localhost", 8090, "", PropertiesBuilder.build(new Property("opentracing-tracer-class-name", "io.opentracing.mock.MockTracer"))), true); + pluginLifecycleService.start(new PluginConfiguration("localhost", 8090, "", PropertiesBuilder.build(new Property("opentracing-tracer-class-name", "io.opentracing.mock.MockTracer"))), true); assertTrue(GlobalTracer.isRegistered()); } } diff --git a/agent/plugins/tracing/type/zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginBootService.java b/agent/plugins/tracing/type/zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginLifecycleService.java similarity index 95% rename from agent/plugins/tracing/type/zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginBootService.java rename to agent/plugins/tracing/type/zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginLifecycleService.java index 72a166876b1bb..e5a475d9143ba 100644 --- a/agent/plugins/tracing/type/zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginBootService.java +++ b/agent/plugins/tracing/type/zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginLifecycleService.java @@ -23,7 +23,7 @@ import brave.sampler.Sampler; import org.apache.shardingsphere.agent.api.PluginConfiguration; import org.apache.shardingsphere.agent.plugin.core.config.validator.PluginConfigurationValidator; -import org.apache.shardingsphere.agent.spi.PluginBootService; +import org.apache.shardingsphere.agent.spi.PluginLifecycleService; import zipkin2.reporter.brave.AsyncZipkinSpanHandler; import zipkin2.reporter.okhttp3.OkHttpSender; @@ -31,9 +31,9 @@ import java.util.Properties; /** - * Zipkin tracing plugin boot service. + * Zipkin tracing plugin lifecycle service. */ -public final class ZipkinTracingPluginBootService implements PluginBootService { +public final class ZipkinTracingPluginLifecycleService implements PluginLifecycleService { private static final String DEFAULT_SERVICE_NAME = "shardingsphere"; diff --git a/agent/plugins/tracing/type/zipkin/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService b/agent/plugins/tracing/type/zipkin/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService similarity index 97% rename from agent/plugins/tracing/type/zipkin/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService rename to agent/plugins/tracing/type/zipkin/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService index 5a21475c58adf..8dc05d4b44e14 100644 --- a/agent/plugins/tracing/type/zipkin/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginBootService +++ b/agent/plugins/tracing/type/zipkin/src/main/resources/META-INF/services/org.apache.shardingsphere.agent.spi.PluginLifecycleService @@ -15,4 +15,4 @@ # limitations under the License. # -org.apache.shardingsphere.agent.plugin.tracing.zipkin.ZipkinTracingPluginBootService +org.apache.shardingsphere.agent.plugin.tracing.zipkin.ZipkinTracingPluginLifecycleService diff --git a/agent/plugins/tracing/type/zipkin/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginBootServiceTest.java b/agent/plugins/tracing/type/zipkin/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginLifecycleServiceTest.java similarity index 76% rename from agent/plugins/tracing/type/zipkin/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginBootServiceTest.java rename to agent/plugins/tracing/type/zipkin/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginLifecycleServiceTest.java index 155468ec9a642..569f89698e3aa 100644 --- a/agent/plugins/tracing/type/zipkin/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginBootServiceTest.java +++ b/agent/plugins/tracing/type/zipkin/src/test/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginLifecycleServiceTest.java @@ -27,19 +27,19 @@ import static org.junit.Assert.assertNotNull; -public final class ZipkinTracingPluginBootServiceTest { +public final class ZipkinTracingPluginLifecycleServiceTest { - private final ZipkinTracingPluginBootService pluginBootService = new ZipkinTracingPluginBootService(); + private final ZipkinTracingPluginLifecycleService pluginLifecycleService = new ZipkinTracingPluginLifecycleService(); @After public void close() { - pluginBootService.close(); + pluginLifecycleService.close(); } @Test public void assertStart() throws ReflectiveOperationException { - pluginBootService.start(new PluginConfiguration("localhost", 9441, "", new Properties()), true); - Tracing tracing = (Tracing) Plugins.getMemberAccessor().get(ZipkinTracingPluginBootService.class.getDeclaredField("tracing"), pluginBootService); + pluginLifecycleService.start(new PluginConfiguration("localhost", 9441, "", new Properties()), true); + Tracing tracing = (Tracing) Plugins.getMemberAccessor().get(ZipkinTracingPluginLifecycleService.class.getDeclaredField("tracing"), pluginLifecycleService); assertNotNull(tracing.tracer()); } } diff --git a/docs/document/content/dev-manual/agent.cn.md b/docs/document/content/dev-manual/agent.cn.md index 91d22671b434d..2392c2be2bc14 100644 --- a/docs/document/content/dev-manual/agent.cn.md +++ b/docs/document/content/dev-manual/agent.cn.md @@ -5,23 +5,23 @@ weight = 14 chapter = true +++ -## PluginBootService +## PluginLifecycleService ### 全限定类名 -[`org.apache.shardingsphere.agent.spi.PluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/api/src/main/java/org/apache/shardingsphere/agent/spi/PluginBootService.java) +[`org.apache.shardingsphere.agent.spi.PluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/api/src/main/java/org/apache/shardingsphere/agent/spi/PluginLifecycleService.java) ### 定义 -插件启动服务定义接口 +插件生命周期管理接口 ### 已知实现 -| *配置标识* | *详细说明* | *全限定类名* | -| ------------- | --------------------------------- | ---------- | -| Prometheus | Prometheus plugin 启动类 | [`org.apache.shardingsphere.agent.plugin.metrics.prometheus.PrometheusPluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginBootService.java) | -| Logging | Logging plugin 启动类 | [`org.apache.shardingsphere.agent.plugin.logging.file.FileLoggingPluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginBootService.java) | -| Jaeger | Jaeger plugin 启动类 | [`org.apache.shardingsphere.agent.plugin.tracing.jaeger.JaegerTracingPluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/jaeger/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginBootService.java) | -| OpenTelemetry | OpenTelemetryTracing plugin 启动类 | [`org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.OpenTelemetryTracingPluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginBootService.java) | -| OpenTracing | OpenTracing plugin 启动类 | [`org.apache.shardingsphere.agent.plugin.tracing.opentracing.OpenTracingPluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginBootService.java) | -| Zipkin | Zipkin plugin 启动类 | [`org.apache.shardingsphere.agent.plugin.tracing.zipkin.ZipkinTracingPluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginBootService.java) | +| *配置标识* | *详细说明* | *全限定类名* | +| ------------- | ---------------------------- | ---------- | +| Prometheus | Prometheus 插件生命周期管理类 | [`org.apache.shardingsphere.agent.plugin.metrics.prometheus.PrometheusPluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java) | +| File | File 插件生命周期管理类 | [`org.apache.shardingsphere.agent.plugin.logging.file.FileLoggingPluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginLifecycleService.java) | +| Jaeger | Jaeger 插件生命周期管理类 | [`org.apache.shardingsphere.agent.plugin.tracing.jaeger.JaegerTracingPluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/jaeger/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginLifecycleService.java) | +| OpenTelemetry | OpenTelemetry 插件生命周期管理类 | [`org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.OpenTelemetryTracingPluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginLifecycleService.java) | +| OpenTracing | OpenTracing 插件生命周期管理类 | [`org.apache.shardingsphere.agent.plugin.tracing.opentracing.OpenTracingPluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginLifecycleService.java) | +| Zipkin | Zipkin 插件生命周期管理类 | [`org.apache.shardingsphere.agent.plugin.tracing.zipkin.ZipkinTracingPluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginLifecycleService.java) | diff --git a/docs/document/content/dev-manual/agent.en.md b/docs/document/content/dev-manual/agent.en.md index b2bac4b86a978..379efed8fe52d 100644 --- a/docs/document/content/dev-manual/agent.en.md +++ b/docs/document/content/dev-manual/agent.en.md @@ -5,23 +5,23 @@ weight = 14 chapter = true +++ -## PluginBootService +## PluginLifecycleService ### Fully-qualified class name -[`org.apache.shardingsphere.agent.spi.PluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/api/src/main/java/org/apache/shardingsphere/agent/spi/PluginBootService.java) +[`org.apache.shardingsphere.agent.spi.PluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/api/src/main/java/org/apache/shardingsphere/agent/spi/PluginLifecycleService.java) ### Definition -Plugin startup service definition +Plug lifecycle management interface ### Implementation classes -| *Configuration Type* | *Description* | *Fully-qualified class name* | -| -------------------- | ----------------------------------------- | ---------------------------- | -| Prometheus | Prometheus plugin startup class | [`org.apache.shardingsphere.agent.plugin.metrics.prometheus.PrometheusPluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginBootService.java) | -| Logging | Logging plugin startup class | [`org.apache.shardingsphere.agent.plugin.logging.file.FileLoggingPluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginBootService.java) | -| Jaeger | Jaeger plugin startup class | [`org.apache.shardingsphere.agent.plugin.tracing.jaeger.JaegerTracingPluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/jaeger/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginBootService.java) | -| OpenTelemetry | OpenTelemetryTracing plugin startup class | [`org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.OpenTelemetryTracingPluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginBootService.java) | -| OpenTracing | OpenTracing plugin startup class | [`org.apache.shardingsphere.agent.plugin.tracing.opentracing.OpenTracingPluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginBootService.java) | -| Zipkin | Zipkin plugin startup class | [`org.apache.shardingsphere.agent.plugin.tracing.zipkin.ZipkinTracingPluginBootService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginBootService.java) | +| *Configuration Type* | *Description* | *Fully-qualified class name* | +| -------------------- | ---------------------------------------------------- | ---------------------------- | +| Prometheus | Prometheus plug lifecycle management class | [`org.apache.shardingsphere.agent.plugin.metrics.prometheus.PrometheusPluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/metrics/type/prometheus/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/PrometheusPluginLifecycleService.java) | +| File | Logging plug lifecycle management class | [`org.apache.shardingsphere.agent.plugin.logging.file.FileLoggingPluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/logging/type/file/src/main/java/org/apache/shardingsphere/agent/plugin/logging/file/FileLoggingPluginLifecycleService.java) | +| Jaeger | Jaeger plug lifecycle management class | [`org.apache.shardingsphere.agent.plugin.tracing.jaeger.JaegerTracingPluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/jaeger/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/jaeger/JaegerTracingPluginLifecycleService.java) | +| OpenTelemetry | OpenTelemetryTracing plug lifecycle management class | [`org.apache.shardingsphere.agent.plugin.tracing.opentelemetry.OpenTelemetryTracingPluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/opentelemetry/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentelemetry/OpenTelemetryTracingPluginLifecycleService.java) | +| OpenTracing | OpenTracing plug lifecycle management class | [`org.apache.shardingsphere.agent.plugin.tracing.opentracing.OpenTracingPluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/opentracing/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/opentracing/OpenTracingPluginLifecycleService.java) | +| Zipkin | Zipkin plug lifecycle management class | [`org.apache.shardingsphere.agent.plugin.tracing.zipkin.ZipkinTracingPluginLifecycleService`](https://github.com/apache/shardingsphere/blob/master/agent/plugins/tracing/type/zipkin/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/zipkin/ZipkinTracingPluginLifecycleService.java) | diff --git a/docs/document/content/dev-manual/sharding.cn.md b/docs/document/content/dev-manual/sharding.cn.md index 9b2998c4f5d97..332f175b5eb9c 100644 --- a/docs/document/content/dev-manual/sharding.cn.md +++ b/docs/document/content/dev-manual/sharding.cn.md @@ -17,21 +17,21 @@ chapter = true ### 已知实现 -| *配置标识* | *自动分片算法* | *详细说明* | *全限定类名* | -| ------------------------ |----------| ----------------------------------------------------------------------- | ---------------------------- | -| MOD | Y | 基于取模的分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.mod.ModShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithm.java) | -| HASH_MOD | Y | 基于哈希取模的分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.mod.HashModShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithm.java) | -| BOUNDARY_RANGE | Y | 基于分片边界的范围分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.range.BoundaryBasedRangeShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/BoundaryBasedRangeShardingAlgorithm.java) | -| VOLUME_RANGE | Y | 基于分片容量的范围分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.range.VolumeBasedRangeShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/VolumeBasedRangeShardingAlgorithm.java) | -| AUTO_INTERVAL | Y | 基于可变时间范围的分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.datetime.AutoIntervalShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java) | -| INTERVAL | N | 基于固定时间范围的分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java) | -| CLASS_BASED | N | 基于自定义类的分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java) | -| INLINE | N | 基于行表达式的分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java) | -| COMPLEX_INLINE | N | 基于行表达式的复合分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.complex.ComplexInlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithm.java) | -| HINT_INLINE | N | 基于行表达式的 Hint 分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/hint/HintInlineShardingAlgorithm.java) | -| COSID_MOD | N | 基于 CosId 的取模分片算法 | [`org.apache.shardingsphere.sharding.cosid.algorithm.sharding.mod.CosIdModShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/mod/CosIdModShardingAlgorithm.java) | -| COSID_INTERVAL | N | 基于 CosId 的固定时间范围的分片算法 | [`org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.CosIdIntervalShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/CosIdIntervalShardingAlgorithm.java) | -| COSID_INTERVAL_SNOWFLAKE | N | 基于 CosId 的雪花ID固定时间范围的分片算法 | [`org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.CosIdSnowflakeIntervalShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/CosIdSnowflakeIntervalShardingAlgorithm.java) | +| *配置标识* | *自动分片算法* | *详细说明* | *全限定类名* | +| ------------------------ | ----------- | ----------------------------------- | ---------- | +| MOD | Y | 基于取模的分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.mod.ModShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithm.java) | +| HASH_MOD | Y | 基于哈希取模的分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.mod.HashModShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithm.java) | +| BOUNDARY_RANGE | Y | 基于分片边界的范围分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.range.BoundaryBasedRangeShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/BoundaryBasedRangeShardingAlgorithm.java) | +| VOLUME_RANGE | Y | 基于分片容量的范围分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.range.VolumeBasedRangeShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/VolumeBasedRangeShardingAlgorithm.java) | +| AUTO_INTERVAL | Y | 基于可变时间范围的分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.datetime.AutoIntervalShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java) | +| INTERVAL | N | 基于固定时间范围的分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java) | +| CLASS_BASED | N | 基于自定义类的分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java) | +| INLINE | N | 基于行表达式的分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java) | +| COMPLEX_INLINE | N | 基于行表达式的复合分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.complex.ComplexInlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithm.java) | +| HINT_INLINE | N | 基于行表达式的 Hint 分片算法 | [`org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/hint/HintInlineShardingAlgorithm.java) | +| COSID_MOD | N | 基于 CosId 的取模分片算法 | [`org.apache.shardingsphere.sharding.cosid.algorithm.sharding.mod.CosIdModShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/mod/CosIdModShardingAlgorithm.java) | +| COSID_INTERVAL | N | 基于 CosId 的固定时间范围的分片算法 | [`org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.CosIdIntervalShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/CosIdIntervalShardingAlgorithm.java) | +| COSID_INTERVAL_SNOWFLAKE | N | 基于 CosId 的雪花ID固定时间范围的分片算法 | [`org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.CosIdSnowflakeIntervalShardingAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/CosIdSnowflakeIntervalShardingAlgorithm.java) | ## KeyGenerateAlgorithm @@ -45,13 +45,13 @@ chapter = true ### 已知实现 -| *配置标识* | *详细说明* | *全限定类名* | -| -------------------- | -------------------------------------------------- | ---------------------------- | -| SNOWFLAKE | 基于雪花算法的分布式主键生成算法 | [`org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/SnowflakeKeyGenerateAlgorithm.java) | -| UUID | 基于 UUID 的分布式主键生成算法 | [`org.apache.shardingsphere.sharding.algorithm.keygen.UUIDKeyGenerateAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/UUIDKeyGenerateAlgorithm.java) | -| NANOID | 基于 NanoId 的分布式主键生成算法 | [`org.apache.shardingsphere.sharding.nanoid.algorithm.keygen.NanoIdKeyGenerateAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/nanoid/src/main/java/org/apache/shardingsphere/sharding/nanoid/algorithm/keygen/NanoIdKeyGenerateAlgorithm.java) | -| COSID | 基于 CosId 的分布式主键生成算法 | [`org.apache.shardingsphere.sharding.cosid.algorithm.keygen.CosIdKeyGenerateAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdKeyGenerateAlgorithm.java) | -| COSID_SNOWFLAKE | 基于 CosId 的雪花算法分布式主键生成算法 | [`org.apache.shardingsphere.sharding.cosid.algorithm.keygen.CosIdSnowflakeKeyGenerateAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdSnowflakeKeyGenerateAlgorithm.java) | +| *配置标识* | *详细说明* | *全限定类名* | +| --------------- | --------------------------------- | ---------- | +| SNOWFLAKE | 基于雪花算法的分布式主键生成算法 | [`org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/SnowflakeKeyGenerateAlgorithm.java) | +| UUID | 基于 UUID 的分布式主键生成算法 | [`org.apache.shardingsphere.sharding.algorithm.keygen.UUIDKeyGenerateAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/UUIDKeyGenerateAlgorithm.java) | +| NANOID | 基于 NanoId 的分布式主键生成算法 | [`org.apache.shardingsphere.sharding.nanoid.algorithm.keygen.NanoIdKeyGenerateAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/nanoid/src/main/java/org/apache/shardingsphere/sharding/nanoid/algorithm/keygen/NanoIdKeyGenerateAlgorithm.java) | +| COSID | 基于 CosId 的分布式主键生成算法 | [`org.apache.shardingsphere.sharding.cosid.algorithm.keygen.CosIdKeyGenerateAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdKeyGenerateAlgorithm.java) | +| COSID_SNOWFLAKE | 基于 CosId 的雪花算法分布式主键生成算法 | [`org.apache.shardingsphere.sharding.cosid.algorithm.keygen.CosIdSnowflakeKeyGenerateAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdSnowflakeKeyGenerateAlgorithm.java) | ## ShardingAuditAlgorithm @@ -65,9 +65,9 @@ chapter = true ### 已知实现 -| *配置标识* | *详细说明* | *全限定类名* | -| ----------------------- | ------------------------------------------------------------- | ---------------------------- | -| DML_SHARDING_CONDITIONS | 禁止不带分片键的DML审计算法 | [`org.apache.shardingsphere.sharding.algorithm.audit.DMLShardingConditionsShardingAuditAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/audit/DMLShardingConditionsShardingAuditAlgorithm.java) | +| *配置标识* | *详细说明* | *全限定类名* | +| ----------------------- | ---------------------- | ---------- | +| DML_SHARDING_CONDITIONS | 禁止不带分片键的DML审计算法 | [`org.apache.shardingsphere.sharding.algorithm.audit.DMLShardingConditionsShardingAuditAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/audit/DMLShardingConditionsShardingAuditAlgorithm.java) | ## DatetimeService @@ -81,9 +81,9 @@ chapter = true ### 已知实现 -| *配置标识* | *详细说明* | *全限定类名* | -| ----------------------- | ------------------------------------------------------------ | ---------------------------- | -| DatabaseDatetimeService | 从数据库中获取当前时间进行路由 | [`org.apache.shardingsphere.agent.metrics.prometheus.service.PrometheusPluginBootService`](https://github.com/apache/shardingsphere/blob/master/infra/datetime/type/database/src/main/java/org/apache/shardingsphere/datetime/database/DatabaseDatetimeService.java) | +| *配置标识* | *详细说明* | *全限定类名* | +| ----------------------- | ----------------------------- | ---------- | +| DatabaseDatetimeService | 从数据库中获取当前时间进行路由 | [`org.apache.shardingsphere.datetime.database.DatabaseDatetimeService`](https://github.com/apache/shardingsphere/blob/master/infra/datetime/type/database/src/main/java/org/apache/shardingsphere/datetime/database/DatabaseDatetimeService.java) | | SystemDatetime | 从应用系统时间中获取当前时间进行路由 | [`org.apache.shardingsphere.datetime.system.SystemDatetimeService`](https://github.com/apache/shardingsphere/blob/master/infra/datetime/type/system/src/main/java/org/apache/shardingsphere/datetime/system/SystemDatetimeService.java) | ## ShardingConditionEngine @@ -98,6 +98,6 @@ chapter = true ### 已知实现 -| *配置标识* | *详细说明* | *全限定类名* | -|--------------------------------|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| *配置标识* | *详细说明* | *全限定类名* | +| ------------------------------ | ---------------- | ---------- | | DefaultShardingConditionEngine | 默认分片条件生成引擎 | [`org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.DefaultShardingConditionEngine`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/impl/DefaultShardingConditionEngine.java) | diff --git a/docs/document/content/dev-manual/sharding.en.md b/docs/document/content/dev-manual/sharding.en.md index b68c8e9f9374d..3a90bdccbf809 100644 --- a/docs/document/content/dev-manual/sharding.en.md +++ b/docs/document/content/dev-manual/sharding.en.md @@ -83,7 +83,7 @@ Obtain the current date for routing definition | *Configuration Type* | *Description* | *Fully-qualified class name* | | ----------------------- | ------------------------------------------------------------ | ---------------------------- | -| DatabaseDatetimeService | Get the current time from the database for routing | [`org.apache.shardingsphere.agent.metrics.prometheus.service.PrometheusPluginBootService`](https://github.com/apache/shardingsphere/blob/master/infra/datetime/type/database/src/main/java/org/apache/shardingsphere/datetime/database/DatabaseDatetimeService.java) | +| DatabaseDatetimeService | Get the current time from the database for routing | [`org.apache.shardingsphere.datetime.database.DatabaseDatetimeService`](https://github.com/apache/shardingsphere/blob/master/infra/datetime/type/database/src/main/java/org/apache/shardingsphere/datetime/database/DatabaseDatetimeService.java) | | SystemDatetime | Get the current time from the application system for routing | [`org.apache.shardingsphere.datetime.system.SystemDatetimeService`](https://github.com/apache/shardingsphere/blob/master/infra/datetime/type/system/src/main/java/org/apache/shardingsphere/datetime/system/SystemDatetimeService.java) | ## ShardingConditionEngine @@ -98,6 +98,6 @@ Sharding condition generator engine ### Implementation classes -| *Configuration Type* | *Description* | *Fully-qualified class name* | -|--------------------------------|---------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| *Configuration Type* | *Description* | *Fully-qualified class name* | +| ------------------------------ | ------------------------------------------- | ---------------------------- | | DefaultShardingConditionEngine | Default sharding condition generator engine | [`org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.DefaultShardingConditionEngine`](https://github.com/apache/shardingsphere/blob/master/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/impl/DefaultShardingConditionEngine.java) |