Skip to content

Commit

Permalink
Refactor ClusterEventSubscriberRegistry (#34247)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Jan 4, 2025
1 parent 52a599d commit d5d7eb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -91,8 +90,8 @@ private Collection<String> getDatabaseNames(final ContextManagerBuilderParameter
: metaDataPersistService.getDatabaseMetaDataFacade().getDatabase().loadAllDatabaseNames();
}

private Collection<EventSubscriber> createDeliverEventSubscribers(final PersistRepository repository) {
Collection<EventSubscriber> result = new LinkedList<>();
private Collection<DeliverEventSubscriber> createDeliverEventSubscribers(final PersistRepository repository) {
Collection<DeliverEventSubscriber> result = new LinkedList<>();
for (DeliverEventSubscriber each : ShardingSphereServiceLoader.getServiceInstances(DeliverEventSubscriber.class)) {
each.setRepository(repository);
result.add(each);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -36,7 +36,7 @@ public final class ClusterEventSubscriberRegistry {
*
* @param subscribers to be registered subscribers
*/
public void register(final Collection<EventSubscriber> subscribers) {
public void register(final Collection<DeliverEventSubscriber> subscribers) {
subscribers.forEach(eventBusContext::register);
}
}

0 comments on commit d5d7eb2

Please sign in to comment.