Skip to content

Commit

Permalink
Remove DispatchEventBuilder (#34217)
Browse files Browse the repository at this point in the history
* Remove DispatchEventBuilder

* Remove DispatchEventBuilder
  • Loading branch information
terrymanu authored Jan 1, 2025
1 parent 9d5fc4d commit 9938d48
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 191 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
import org.apache.shardingsphere.metadata.persist.node.DatabaseMetaDataNode;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.manager.cluster.event.dispatch.builder.DispatchEventBuilder;
import org.apache.shardingsphere.mode.manager.cluster.event.dispatch.handler.DataChangedEventHandler;
import org.apache.shardingsphere.mode.manager.cluster.event.dispatch.listener.type.DatabaseMetaDataChangedListener;
import org.apache.shardingsphere.mode.manager.cluster.event.dispatch.listener.type.GlobalMetaDataChangedHandler;
import org.apache.shardingsphere.mode.manager.cluster.event.dispatch.listener.type.GlobalMetaDataChangedListener;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;

import java.util.Collection;
Expand Down Expand Up @@ -55,18 +53,13 @@ public DataChangedEventListenerRegistry(final ContextManager contextManager, fin
*/
public void register() {
databaseNames.forEach(this::registerDatabaseListeners);
ShardingSphereServiceLoader.getServiceInstances(DispatchEventBuilder.class).forEach(this::registerGlobalListeners);
ShardingSphereServiceLoader.getServiceInstances(DataChangedEventHandler.class).forEach(this::registerGlobalHandlers);
}

private void registerDatabaseListeners(final String databaseName) {
repository.watch(DatabaseMetaDataNode.getDatabaseNamePath(databaseName), new DatabaseMetaDataChangedListener(eventBusContext));
}

private void registerGlobalListeners(final DispatchEventBuilder<?> builder) {
repository.watch(builder.getSubscribedKey(), new GlobalMetaDataChangedListener(eventBusContext, builder));
}

private void registerGlobalHandlers(final DataChangedEventHandler handler) {
repository.watch(handler.getSubscribedKey(), new GlobalMetaDataChangedHandler(contextManager, handler));
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 9938d48

Please sign in to comment.