This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 514ab46 Move ClusterInstance to mode-core and rename to Instance
(#14269)
514ab46 is described below
commit 514ab46b726215581eb46f597e40c851267289fa
Author: Haoran Meng <[email protected]>
AuthorDate: Thu Dec 23 18:02:19 2021 +0800
Move ClusterInstance to mode-core and rename to Instance (#14269)
---
.../apache/shardingsphere/mode/instance/Instance.java} | 14 +++++++-------
.../shardingsphere/mode/instance}/utils/IpUtils.java | 2 +-
.../shardingsphere/mode/instance/InstanceTest.java} | 18 +++++++++---------
.../mode/instance}/utils/IpUtilsTest.java | 2 +-
.../manager/cluster/coordinator/RegistryCenter.java | 3 ++-
.../coordinator/lock/service/LockRegistryService.java | 4 ++--
.../compute/service/ComputeNodeStatusService.java | 4 ++--
.../subscriber/ComputeNodeStatusSubscriber.java | 4 ++--
.../watcher/ComputeNodeStateChangedWatcher.java | 4 ++--
.../lock/service/LockRegistryServiceTest.java | 4 ++--
.../compute/service/ComputeNodeStatusServiceTest.java | 6 +++---
.../watcher/ComputeNodeStateChangedWatcherTest.java | 12 ++++++------
.../ral/common/show/executor/ShowInstanceExecutor.java | 2 +-
13 files changed, 40 insertions(+), 39 deletions(-)
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterInstance.java
b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/instance/Instance.java
similarity index 82%
rename from
shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterInstance.java
rename to
shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/instance/Instance.java
index 0841c6f..69e024d 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterInstance.java
+++
b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/instance/Instance.java
@@ -15,30 +15,30 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.mode.manager.cluster.coordinator;
+package org.apache.shardingsphere.mode.instance;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
-import
org.apache.shardingsphere.mode.manager.cluster.coordinator.utils.IpUtils;
+import org.apache.shardingsphere.mode.instance.utils.IpUtils;
import java.lang.management.ManagementFactory;
/**
- * Cluster instance.
+ * Instance.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Getter
-public final class ClusterInstance {
+public final class Instance {
private static final String DELIMITER = "@";
- private static final ClusterInstance INSTANCE = new ClusterInstance();
+ private static final Instance INSTANCE = new Instance();
private volatile String id;
/**
- * Init cluster instance.
+ * Init instance.
*
* @param port port
*/
@@ -62,7 +62,7 @@ public final class ClusterInstance {
*
* @return singleton instance
*/
- public static ClusterInstance getInstance() {
+ public static Instance getInstance() {
return INSTANCE;
}
}
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/utils/IpUtils.java
b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/instance/utils/IpUtils.java
similarity index 97%
rename from
shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/utils/IpUtils.java
rename to
shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/instance/utils/IpUtils.java
index 0d354be..b517f85 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/utils/IpUtils.java
+++
b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/instance/utils/IpUtils.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.mode.manager.cluster.coordinator.utils;
+package org.apache.shardingsphere.mode.instance.utils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterInstanceTest.java
b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/instance/InstanceTest.java
similarity index 72%
rename from
shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterInstanceTest.java
rename to
shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/instance/InstanceTest.java
index eac78b2..cf592b4 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterInstanceTest.java
+++
b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/instance/InstanceTest.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.mode.manager.cluster.coordinator;
+package org.apache.shardingsphere.mode.instance;
import com.google.common.base.Joiner;
-import
org.apache.shardingsphere.mode.manager.cluster.coordinator.utils.IpUtils;
+import org.apache.shardingsphere.mode.instance.utils.IpUtils;
import org.junit.Test;
import java.lang.management.ManagementFactory;
@@ -26,30 +26,30 @@ import java.lang.management.ManagementFactory;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
-public final class ClusterInstanceTest {
+public final class InstanceTest {
private String ip = IpUtils.getIp();
@Test
public void assertGetIdWithPort() {
- ClusterInstance.getInstance().init(3307);
- String id = ClusterInstance.getInstance().getId();
+ Instance.getInstance().init(3307);
+ String id = Instance.getInstance().getId();
assertThat(id.split("@").length, is(2));
assertThat(id, is(Joiner.on("@").join(ip, 3307)));
}
@Test
public void assertGetDefaultId() {
- ClusterInstance.getInstance().init(null);
+ Instance.getInstance().init(null);
String pid =
ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
- String id = ClusterInstance.getInstance().getId();
+ String id = Instance.getInstance().getId();
assertThat(id.split("@").length, is(2));
assertThat(id, is(Joiner.on("@").join(ip, pid)));
}
@Test
public void assertGetInstanceId() {
- ClusterInstance.getInstance().init(null);
- assertThat(ClusterInstance.getInstance().getInstanceId("127.0.0.1",
"3307"), is("127.0.0.1@3307"));
+ Instance.getInstance().init(null);
+ assertThat(Instance.getInstance().getInstanceId("127.0.0.1", "3307"),
is("127.0.0.1@3307"));
}
}
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/utils/IpUtilsTest.java
b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/instance/utils/IpUtilsTest.java
similarity index 93%
rename from
shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/utils/IpUtilsTest.java
rename to
shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/instance/utils/IpUtilsTest.java
index d725359..f4ae686 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/utils/IpUtilsTest.java
+++
b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/instance/utils/IpUtilsTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.mode.manager.cluster.coordinator.utils;
+package org.apache.shardingsphere.mode.instance.utils;
import org.junit.Test;
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java
index 220c17b..871d22b 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.mode.manager.cluster.coordinator;
import lombok.Getter;
+import org.apache.shardingsphere.mode.instance.Instance;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.service.LockRegistryService;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.GovernanceWatcherFactory;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.cache.subscriber.ScalingRegistrySubscriber;
@@ -51,7 +52,7 @@ public final class RegistryCenter {
public RegistryCenter(final ClusterPersistRepository repository, final
Integer port) {
this.repository = repository;
- ClusterInstance.getInstance().init(port);
+ Instance.getInstance().init(port);
storageNodeStatusService = new StorageNodeStatusService(repository);
computeNodeStatusService = new ComputeNodeStatusService(repository);
lockService = new LockRegistryService(repository);
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/service/LockRegistryService.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/service/LockRegistryService.java
index b8bd553..7b1c269 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/service/LockRegistryService.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/service/LockRegistryService.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.service;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
-import
org.apache.shardingsphere.mode.manager.cluster.coordinator.ClusterInstance;
+import org.apache.shardingsphere.mode.instance.Instance;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.ComputeNodeStatus;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.node.ComputeStatusNode;
import
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
@@ -39,7 +39,7 @@ public final class LockRegistryService {
private final ClusterPersistRepository repository;
public LockRegistryService(final ClusterPersistRepository repository) {
- instanceId = ClusterInstance.getInstance().getId();
+ instanceId = Instance.getInstance().getId();
this.repository = repository;
initLockNode();
}
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusService.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusService.java
index 734dcbd..eefb6f2 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusService.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusService.java
@@ -18,7 +18,7 @@
package
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.service;
import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.mode.manager.cluster.coordinator.ClusterInstance;
+import org.apache.shardingsphere.mode.instance.Instance;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.ComputeNodeStatus;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.node.ComputeStatusNode;
import
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
@@ -35,6 +35,6 @@ public final class ComputeNodeStatusService {
* Register online.
*/
public void registerOnline() {
-
repository.persistEphemeral(ComputeStatusNode.getStatusPath(ComputeNodeStatus.ONLINE,
ClusterInstance.getInstance().getId()), "");
+
repository.persistEphemeral(ComputeStatusNode.getStatusPath(ComputeNodeStatus.ONLINE,
Instance.getInstance().getId()), "");
}
}
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatusSubscriber.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatus
[...]
index b436bf0..68b2aa9 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatusSubscriber.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatusSubscriber.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.stat
import com.google.common.eventbus.Subscribe;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
-import
org.apache.shardingsphere.mode.manager.cluster.coordinator.ClusterInstance;
+import org.apache.shardingsphere.mode.instance.Instance;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.ComputeNodeStatus;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.ComputeNodeStatusChangedEvent;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.node.ComputeStatusNode;
@@ -44,7 +44,7 @@ public final class ComputeNodeStatusSubscriber {
*/
@Subscribe
public void update(final ComputeNodeStatusChangedEvent event) {
- String computeNodePath =
ComputeStatusNode.getStatusPath(ComputeNodeStatus.CIRCUIT_BREAKER,
ClusterInstance.getInstance().getInstanceId(event.getIp(), event.getPort()));
+ String computeNodePath =
ComputeStatusNode.getStatusPath(ComputeNodeStatus.CIRCUIT_BREAKER,
Instance.getInstance().getInstanceId(event.getIp(), event.getPort()));
if (event.getStatus() == ComputeNodeStatus.CIRCUIT_BREAKER) {
repository.persist(computeNodePath, "");
} else {
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcher.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChan
[...]
index 9dc8fcd..db9969d 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcher.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcher.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.stat
import org.apache.shardingsphere.infra.state.StateEvent;
import org.apache.shardingsphere.infra.state.StateType;
-import
org.apache.shardingsphere.mode.manager.cluster.coordinator.ClusterInstance;
+import org.apache.shardingsphere.mode.instance.Instance;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.GovernanceWatcher;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.ComputeNodeStatus;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.node.ComputeStatusNode;
@@ -53,6 +53,6 @@ public final class ComputeNodeStateChangedWatcher implements
GovernanceWatcher<S
private boolean isCircuitBreaker(final String dataChangedPath) {
return
dataChangedPath.startsWith(ComputeStatusNode.getStatusPath(ComputeNodeStatus.CIRCUIT_BREAKER))
- && dataChangedPath.substring(dataChangedPath.lastIndexOf("/")
+ 1).equals(ClusterInstance.getInstance().getId());
+ && dataChangedPath.substring(dataChangedPath.lastIndexOf("/")
+ 1).equals(Instance.getInstance().getId());
}
}
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/service/LockRegistryServiceTest.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/service/LockRegistryServiceTest.java
index 38d2710..ee3cbf8 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/service/LockRegistryServiceTest.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/service/LockRegistryServiceTest.java
@@ -17,7 +17,7 @@
package
org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.service;
-import
org.apache.shardingsphere.mode.manager.cluster.coordinator.ClusterInstance;
+import org.apache.shardingsphere.mode.instance.Instance;
import
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import org.junit.Before;
import org.junit.Test;
@@ -41,7 +41,7 @@ public final class LockRegistryServiceTest {
@Before
public void setUp() throws ReflectiveOperationException {
- ClusterInstance.getInstance().init(3307);
+ Instance.getInstance().init(3307);
lockRegistryService = new
LockRegistryService(clusterPersistRepository);
Field field =
lockRegistryService.getClass().getDeclaredField("repository");
field.setAccessible(true);
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusServiceTest.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusServi
[...]
index 957c394..9302999 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusServiceTest.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusServiceTest.java
@@ -17,7 +17,7 @@
package
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.service;
-import
org.apache.shardingsphere.mode.manager.cluster.coordinator.ClusterInstance;
+import org.apache.shardingsphere.mode.instance.Instance;
import
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import org.junit.Before;
import org.junit.Test;
@@ -35,12 +35,12 @@ public final class ComputeNodeStatusServiceTest {
@Before
public void setUp() {
- ClusterInstance.getInstance().init(3307);
+ Instance.getInstance().init(3307);
}
@Test
public void assertRegisterOnline() {
new ComputeNodeStatusService(repository).registerOnline();
- verify(repository).persistEphemeral("/status/compute_nodes/online/" +
ClusterInstance.getInstance().getId(), "");
+ verify(repository).persistEphemeral("/status/compute_nodes/online/" +
Instance.getInstance().getId(), "");
}
}
diff --git
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcherTest.java
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeState
[...]
index 28724d3..ae1ff63 100644
---
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcherTest.java
+++
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcherTest.java
@@ -18,7 +18,7 @@
package
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.watcher;
import org.apache.shardingsphere.infra.state.StateEvent;
-import
org.apache.shardingsphere.mode.manager.cluster.coordinator.ClusterInstance;
+import org.apache.shardingsphere.mode.instance.Instance;
import
org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent;
import
org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent.Type;
import org.junit.After;
@@ -37,17 +37,17 @@ public final class ComputeNodeStateChangedWatcherTest {
@Before
public void setUp() throws NoSuchFieldException, IllegalAccessException {
- originalClusterInstanceId = ClusterInstance.getInstance().getId();
- Field field = ClusterInstance.class.getDeclaredField("id");
+ originalClusterInstanceId = Instance.getInstance().getId();
+ Field field = Instance.class.getDeclaredField("id");
field.setAccessible(true);
- field.set(ClusterInstance.getInstance(), "127.0.0.1@3307");
+ field.set(Instance.getInstance(), "127.0.0.1@3307");
}
@After
public void tearDown() throws NoSuchFieldException, IllegalAccessException
{
- Field field = ClusterInstance.class.getDeclaredField("id");
+ Field field = Instance.class.getDeclaredField("id");
field.setAccessible(true);
- field.set(ClusterInstance.getInstance(), originalClusterInstanceId);
+ field.set(Instance.getInstance(), originalClusterInstanceId);
}
@Test
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowInstanceExecutor.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowInstanceExecutor.java
index 352d6dd..170ec19 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowInstanceExecutor.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/executor/ShowInstanceExecutor.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.show.exe
import org.apache.shardingsphere.infra.merge.result.MergedResult;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.ComputeNodeStatus;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.node.ComputeStatusNode;
-import
org.apache.shardingsphere.mode.manager.cluster.coordinator.utils.IpUtils;
+import org.apache.shardingsphere.mode.instance.utils.IpUtils;
import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import
org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;