This is an automated email from the ASF dual-hosted git repository.
menghaoran 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 1f849a6c4c2 Private InstanceContext.workerIdGenerator (#19275)
1f849a6c4c2 is described below
commit 1f849a6c4c2cf8dfc12ab1e0889fbe86e58f77cd
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Jul 16 23:38:49 2022 +0800
Private InstanceContext.workerIdGenerator (#19275)
---
.../org/apache/shardingsphere/infra/instance/InstanceContext.java | 4 +++-
.../apache/shardingsphere/infra/instance/InstanceContextTest.java | 8 --------
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
index ea1ff3b46e9..d26e9bf9c0c 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.infra.instance;
+import lombok.AccessLevel;
import lombok.Getter;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
import org.apache.shardingsphere.infra.eventbus.EventBusContext;
@@ -40,6 +41,7 @@ public final class InstanceContext {
private final ComputeNodeInstance instance;
+ @Getter(AccessLevel.NONE)
private final WorkerIdGenerator workerIdGenerator;
private final ModeConfiguration modeConfiguration;
@@ -97,7 +99,7 @@ public final class InstanceContext {
/**
* Generate worker id.
*
- * @param props props
+ * @param props properties
* @return worker id
*/
public long generateWorkerId(final Properties props) {
diff --git
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/instance/InstanceContextTest.java
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/instance/InstanceContextTest.java
index d7e3f0f5b6a..a5a39dcb099 100644
---
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/instance/InstanceContextTest.java
+++
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/instance/InstanceContextTest.java
@@ -97,14 +97,6 @@ public final class InstanceContextTest {
assertNotNull(actual);
}
- @Test
- public void assertGetWorkerIdGenerator() {
- WorkerIdGeneratorFixture expected = new
WorkerIdGeneratorFixture(Long.MIN_VALUE);
- InstanceContext context = new InstanceContext(new
ComputeNodeInstance(mock(InstanceMetaData.class)), expected, modeConfig,
lockContext, eventBusContext);
- WorkerIdGeneratorFixture actual = (WorkerIdGeneratorFixture)
context.getWorkerIdGenerator();
- assertThat(actual, is(expected));
- }
-
@Test
public void assertGetModeConfiguration() {
InstanceContext context = new InstanceContext(new
ComputeNodeInstance(mock(InstanceMetaData.class)), new
WorkerIdGeneratorFixture(Long.MIN_VALUE), modeConfig, lockContext,
eventBusContext);