From d5d7eb2be7543557c705926713db940bd60abab7 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Sat, 4 Jan 2025 22:59:49 +0800 Subject: [PATCH] Refactor ClusterEventSubscriberRegistry (#34247) --- .../mode/manager/cluster/ClusterContextManagerBuilder.java | 5 ++--- .../cluster/subscriber/ClusterEventSubscriberRegistry.java | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java index 82bc1e1145acb..1bd21d551f223 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java @@ -26,7 +26,6 @@ import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; import org.apache.shardingsphere.infra.util.eventbus.EventBusContext; -import org.apache.shardingsphere.infra.util.eventbus.EventSubscriber; import org.apache.shardingsphere.metadata.persist.MetaDataPersistService; import org.apache.shardingsphere.mode.deliver.DeliverEventSubscriber; import org.apache.shardingsphere.mode.manager.ContextManager; @@ -91,8 +90,8 @@ private Collection getDatabaseNames(final ContextManagerBuilderParameter : metaDataPersistService.getDatabaseMetaDataFacade().getDatabase().loadAllDatabaseNames(); } - private Collection createDeliverEventSubscribers(final PersistRepository repository) { - Collection result = new LinkedList<>(); + private Collection createDeliverEventSubscribers(final PersistRepository repository) { + Collection result = new LinkedList<>(); for (DeliverEventSubscriber each : ShardingSphereServiceLoader.getServiceInstances(DeliverEventSubscriber.class)) { each.setRepository(repository); result.add(each); diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/subscriber/ClusterEventSubscriberRegistry.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/subscriber/ClusterEventSubscriberRegistry.java index b03062c144ee7..834ad78342738 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/subscriber/ClusterEventSubscriberRegistry.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/subscriber/ClusterEventSubscriberRegistry.java @@ -19,7 +19,7 @@ import lombok.RequiredArgsConstructor; import org.apache.shardingsphere.infra.util.eventbus.EventBusContext; -import org.apache.shardingsphere.infra.util.eventbus.EventSubscriber; +import org.apache.shardingsphere.mode.deliver.DeliverEventSubscriber; import java.util.Collection; @@ -36,7 +36,7 @@ public final class ClusterEventSubscriberRegistry { * * @param subscribers to be registered subscribers */ - public void register(final Collection subscribers) { + public void register(final Collection subscribers) { subscribers.forEach(eventBusContext::register); } }