From acfc086d7265e8e484d0b23311e31edf2c94e549 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Fri, 17 May 2024 20:56:53 +0800 Subject: [PATCH] Remove useless RegistryCenter (#31276) --- .../cluster/coordinator/RegistryCenter.java | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java deleted file mode 100644 index 99c4333add091..0000000000000 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shardingsphere.mode.manager.cluster.coordinator; - -import lombok.Getter; -import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration; -import org.apache.shardingsphere.infra.instance.InstanceContext; -import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData; -import org.apache.shardingsphere.infra.instance.metadata.jdbc.JDBCInstanceMetaData; -import org.apache.shardingsphere.infra.util.eventbus.EventBusContext; -import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.GovernanceWatcherFactory; -import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.service.ComputeNodeStatusService; -import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository; - -import java.util.Collections; -import java.util.Map; - -/** - * Registry center. - */ -public final class RegistryCenter { - - @Getter - private final ClusterPersistRepository repository; - - private final GovernanceWatcherFactory listenerFactory; - - public RegistryCenter(final EventBusContext eventBusContext, - final ClusterPersistRepository repository, final InstanceMetaData instanceMetaData, final Map databaseConfigs) { - this.repository = repository; - listenerFactory = new GovernanceWatcherFactory(repository, eventBusContext, instanceMetaData instanceof JDBCInstanceMetaData ? databaseConfigs.keySet() : Collections.emptyList()); - } - - /** - * Online instance. - * - * @param instanceContext instance context - */ - public void onlineInstance(final InstanceContext instanceContext) { - ComputeNodeStatusService computeNodeStatusService = new ComputeNodeStatusService(repository); - computeNodeStatusService.registerOnline(instanceContext.getInstance().getMetaData()); - computeNodeStatusService.persistInstanceLabels(instanceContext.getInstance().getCurrentInstanceId(), instanceContext.getInstance().getLabels()); - computeNodeStatusService.persistInstanceState(instanceContext.getInstance().getCurrentInstanceId(), instanceContext.getInstance().getState()); - listenerFactory.watchListeners(); - } -}