This is an automated email from the ASF dual-hosted git repository.

panjuan 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 cb3cbe99d8b Remove shardingsphere-memory-mode (#19093)
cb3cbe99d8b is described below

commit cb3cbe99d8bb41d25e55f4bd404ecf7e5cfeb287
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Jul 13 20:39:26 2022 +0800

    Remove shardingsphere-memory-mode (#19093)
---
 .../collector/ProxyInfoCollectorTest.java          |  4 +-
 .../service/PrometheusPluginBootServiceTest.java   |  4 +-
 .../shardingsphere-jdbc-core/pom.xml               |  5 --
 .../pom.xml                                        |  5 --
 .../shardingsphere-mode-type/pom.xml               |  1 -
 .../shardingsphere-memory-mode/pom.xml             | 34 ---------
 .../shardingsphere-memory-mode-core/pom.xml        | 37 ----------
 .../memory/MemoryContextManagerBuilder.java        | 72 -------------------
 .../manager/memory/lock/MemoryLockContext.java     | 56 ---------------
 .../mode/manager/memory/lock/MemoryMutexLock.java  | 58 ---------------
 .../memory/lock/ShardingSphereMemoryLock.java      | 83 ----------------------
 .../generator/MemoryWorkerIdGenerator.java         | 33 ---------
 ...ardingsphere.mode.manager.ContextManagerBuilder | 18 -----
 .../StandaloneContextManagerBuilder.java           |  5 ++
 .../generator/StandaloneWorkerIdGenerator.java     |  2 +-
 .../shardingsphere-proxy-backend/pom.xml           |  5 --
 16 files changed, 10 insertions(+), 412 deletions(-)

diff --git 
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/test/java/org/apache/shardingsphere/agent/metrics/prometheus/collector/ProxyInfoCollectorTest.java
 
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/test/java/org/apache/shardingsphere/agent/metrics/prometheus/collector/ProxyInfoCollectorTest.java
index 58f7f38c1d3..170f43040ad 100644
--- 
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/test/java/org/apache/shardingsphere/agent/metrics/prometheus/collector/ProxyInfoCollectorTest.java
+++ 
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/test/java/org/apache/shardingsphere/agent/metrics/prometheus/collector/ProxyInfoCollectorTest.java
@@ -27,7 +27,7 @@ import 
org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import org.apache.shardingsphere.infra.lock.LockContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.mode.manager.ContextManager;
-import 
org.apache.shardingsphere.mode.manager.memory.workerid.generator.MemoryWorkerIdGenerator;
+import 
org.apache.shardingsphere.mode.manager.standalone.workerid.generator.StandaloneWorkerIdGenerator;
 import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -42,7 +42,7 @@ public final class ProxyInfoCollectorTest extends 
ProxyContextRestorer {
     public void assertCollect() {
         MetaDataContexts metaDataContexts = new 
MetaDataContexts(mock(MetaDataPersistService.class), new 
ShardingSphereMetaData(), mock(OptimizerContext.class));
         InstanceContext instanceContext = new InstanceContext(
-                new ComputeNodeInstance(mock(InstanceMetaData.class)), new 
MemoryWorkerIdGenerator(), new ModeConfiguration("Standalone", null, false), 
mock(LockContext.class),
+                new ComputeNodeInstance(mock(InstanceMetaData.class)), new 
StandaloneWorkerIdGenerator(), new ModeConfiguration("Standalone", null, 
false), mock(LockContext.class),
                 new EventBusContext());
         ProxyContext.init(new ContextManager(metaDataContexts, 
instanceContext));
         assertFalse(new ProxyInfoCollector().collect().isEmpty());
diff --git 
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/test/java/org/apache/shardingsphere/agent/metrics/prometheus/service/PrometheusPluginBootServiceTest.java
 
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/test/java/org/apache/shardingsphere/agent/metrics/prometheus/service/PrometheusPluginBootServiceTest.java
index 6df2e252e33..89384e47015 100644
--- 
a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/test/java/org/apache/shardingsphere/agent/metrics/prometheus/service/PrometheusPluginBootServiceTest.java
+++ 
b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-metrics/shardingsphere-agent-metrics-prometheus/src/test/java/org/apache/shardingsphere/agent/metrics/prometheus/service/PrometheusPluginBootServiceTest.java
@@ -28,7 +28,7 @@ import 
org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import org.apache.shardingsphere.infra.lock.LockContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.mode.manager.ContextManager;
-import 
org.apache.shardingsphere.mode.manager.memory.workerid.generator.MemoryWorkerIdGenerator;
+import 
org.apache.shardingsphere.mode.manager.standalone.workerid.generator.StandaloneWorkerIdGenerator;
 import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -55,7 +55,7 @@ public final class PrometheusPluginBootServiceTest extends 
ProxyContextRestorer
     public void assertStart() throws IOException {
         MetaDataContexts metaDataContexts = new 
MetaDataContexts(mock(MetaDataPersistService.class), new 
ShardingSphereMetaData(), mock(OptimizerContext.class));
         InstanceContext instanceContext = new InstanceContext(
-                new ComputeNodeInstance(mock(InstanceMetaData.class)), new 
MemoryWorkerIdGenerator(), new ModeConfiguration("Standalone", null, false), 
mock(LockContext.class),
+                new ComputeNodeInstance(mock(InstanceMetaData.class)), new 
StandaloneWorkerIdGenerator(), new ModeConfiguration("Standalone", null, 
false), mock(LockContext.class),
                 new EventBusContext());
         ProxyContext.init(new ContextManager(metaDataContexts, 
instanceContext));
         PROMETHEUS_PLUGIN_BOOT_SERVICE.start(new 
PluginConfiguration("localhost", 8090, "", createProperties()));
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/pom.xml 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/pom.xml
index 34c7936c641..28e139825bd 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/pom.xml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/pom.xml
@@ -83,11 +83,6 @@
             <artifactId>shardingsphere-infra-context</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-memory-mode-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-standalone-mode-core</artifactId>
diff --git 
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/pom.xml
 
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/pom.xml
index d15baef983b..f9ec2bc4953 100644
--- 
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/pom.xml
+++ 
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/pom.xml
@@ -28,11 +28,6 @@
     <name>${project.artifactId}</name>
     
     <dependencies>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-memory-mode-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-standalone-mode-core</artifactId>
diff --git a/shardingsphere-mode/shardingsphere-mode-type/pom.xml 
b/shardingsphere-mode/shardingsphere-mode-type/pom.xml
index c8670d03744..ba8d5941890 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/pom.xml
+++ b/shardingsphere-mode/shardingsphere-mode-type/pom.xml
@@ -29,7 +29,6 @@
     <name>${project.artifactId}</name>
     
     <modules>
-        <module>shardingsphere-memory-mode</module>
         <module>shardingsphere-standalone-mode</module>
         <module>shardingsphere-cluster-mode</module>
     </modules>
diff --git 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/pom.xml
 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/pom.xml
deleted file mode 100644
index 169af783780..00000000000
--- 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/pom.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-mode-type</artifactId>
-        <version>5.1.3-SNAPSHOT</version>
-    </parent>
-    <artifactId>shardingsphere-memory-mode</artifactId>
-    <packaging>pom</packaging>
-    <name>${project.artifactId}</name>
-    
-    <modules>
-        <module>shardingsphere-memory-mode-core</module>
-    </modules>
-</project>
diff --git 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/pom.xml
 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/pom.xml
deleted file mode 100644
index 683dcc06bcd..00000000000
--- 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~ 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.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-memory-mode</artifactId>
-        <version>5.1.3-SNAPSHOT</version>
-    </parent>
-    <artifactId>shardingsphere-memory-mode-core</artifactId>
-    <name>${project.artifactId}</name>
-    
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-mode-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-</project>
diff --git 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
deleted file mode 100644
index 17e2251f0ef..00000000000
--- 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
+++ /dev/null
@@ -1,72 +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.memory;
-
-import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
-import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import org.apache.shardingsphere.infra.eventbus.EventBusContext;
-import 
org.apache.shardingsphere.infra.federation.optimizer.context.OptimizerContextFactory;
-import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
-import org.apache.shardingsphere.infra.instance.InstanceContext;
-import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabasesFactory;
-import 
org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
-import org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder;
-import org.apache.shardingsphere.mode.manager.ContextManager;
-import org.apache.shardingsphere.mode.manager.ContextManagerBuilder;
-import org.apache.shardingsphere.mode.manager.ContextManagerBuilderParameter;
-import org.apache.shardingsphere.mode.manager.memory.lock.MemoryLockContext;
-import 
org.apache.shardingsphere.mode.manager.memory.workerid.generator.MemoryWorkerIdGenerator;
-import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
-
-import java.sql.SQLException;
-import java.util.Map;
-import java.util.Optional;
-
-/**
- * Memory context manager builder.
- */
-public final class MemoryContextManagerBuilder implements 
ContextManagerBuilder {
-    
-    @Override
-    public ContextManager build(final ContextManagerBuilderParameter 
parameter) throws SQLException {
-        InstanceContext instanceContext = buildInstanceContext(parameter);
-        return new ContextManager(buildMetaDataContexts(parameter, 
instanceContext), instanceContext);
-    }
-    
-    private InstanceContext buildInstanceContext(final 
ContextManagerBuilderParameter parameter) {
-        ComputeNodeInstance instance = new 
ComputeNodeInstance(parameter.getInstanceMetaData());
-        instance.setLabels(parameter.getLabels());
-        return new InstanceContext(instance,
-                new MemoryWorkerIdGenerator(), 
Optional.ofNullable(parameter.getModeConfig()).orElseGet(() -> new 
ModeConfiguration(getType(), null, false)),
-                new MemoryLockContext(), new EventBusContext());
-    }
-    
-    private MetaDataContexts buildMetaDataContexts(final 
ContextManagerBuilderParameter parameter, final InstanceContext 
instanceContext) throws SQLException {
-        ConfigurationProperties props = new 
ConfigurationProperties(parameter.getProps());
-        Map<String, ShardingSphereDatabase> databases = 
ShardingSphereDatabasesFactory.create(parameter.getDatabaseConfigs(), props, 
instanceContext);
-        ShardingSphereRuleMetaData globalMetaData = new 
ShardingSphereRuleMetaData(GlobalRulesBuilder.buildRules(parameter.getGlobalRuleConfigs(),
 databases, instanceContext));
-        return new MetaDataContexts(null, new 
ShardingSphereMetaData(databases, globalMetaData, props), 
OptimizerContextFactory.create(databases, globalMetaData));
-    }
-    
-    @Override
-    public String getType() {
-        return "Memory";
-    }
-}
diff --git 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/lock/MemoryLockContext.java
 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/lock/MemoryLockContext.java
deleted file mode 100644
index 6872e673ba8..00000000000
--- 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/lock/MemoryLockContext.java
+++ /dev/null
@@ -1,56 +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.memory.lock;
-
-import org.apache.shardingsphere.infra.lock.LockScope;
-import org.apache.shardingsphere.infra.lock.ShardingSphereLock;
-import org.apache.shardingsphere.mode.manager.lock.AbstractLockContext;
-import 
org.apache.shardingsphere.mode.manager.lock.definition.DatabaseLockDefinition;
-
-/**
- * Memory lock context.
- */
-public final class MemoryLockContext extends AbstractLockContext {
-    
-    private final ShardingSphereLock memoryLock = new 
ShardingSphereMemoryLock();
-    
-    @Override
-    public ShardingSphereLock getLock(final LockScope lockScope) {
-        return memoryLock;
-    }
-    
-    @Override
-    protected boolean tryLock(final DatabaseLockDefinition lockDefinition) {
-        return 
memoryLock.tryLock(lockDefinition.getLockNameDefinition().getDatabaseName());
-    }
-    
-    @Override
-    protected boolean tryLock(final DatabaseLockDefinition lockDefinition, 
final long timeoutMilliseconds) {
-        return 
memoryLock.tryLock(lockDefinition.getLockNameDefinition().getDatabaseName(), 
timeoutMilliseconds);
-    }
-    
-    @Override
-    protected void releaseLock(final DatabaseLockDefinition lockDefinition) {
-        
memoryLock.releaseLock(lockDefinition.getLockNameDefinition().getDatabaseName());
-    }
-    
-    @Override
-    protected boolean isLocked(final DatabaseLockDefinition lockDefinition) {
-        return 
memoryLock.isLocked(lockDefinition.getLockNameDefinition().getDatabaseName());
-    }
-}
diff --git 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/lock/MemoryMutexLock.java
 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/lock/MemoryMutexLock.java
deleted file mode 100644
index a95570814e9..00000000000
--- 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/lock/MemoryMutexLock.java
+++ /dev/null
@@ -1,58 +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.memory.lock;
-
-import org.apache.shardingsphere.infra.lock.LockState;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.locks.ReentrantLock;
-
-/**
- * Memory mutex lock.
- */
-public final class MemoryMutexLock extends ReentrantLock {
-    
-    private final AtomicReference<LockState> lockState = new 
AtomicReference<>(LockState.UNLOCKED);
-    
-    @Override
-    public boolean tryLock(final long timeout, final TimeUnit unit) throws 
InterruptedException {
-        if (!lockState.compareAndSet(LockState.UNLOCKED, LockState.LOCKING)) {
-            return false;
-        }
-        boolean isLocked = super.tryLock(timeout, unit);
-        if (isLocked && lockState.compareAndSet(LockState.LOCKING, 
LockState.LOCKED)) {
-            return true;
-        }
-        lockState.compareAndSet(LockState.LOCKING, LockState.UNLOCKED);
-        return false;
-    }
-    
-    @Override
-    public void unlock() {
-        if (LockState.LOCKED == lockState.get()) {
-            super.unlock();
-            lockState.compareAndSet(LockState.LOCKED, LockState.UNLOCKED);
-        }
-    }
-    
-    @Override
-    public boolean isLocked() {
-        return LockState.LOCKED == lockState.get();
-    }
-}
diff --git 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/lock/ShardingSphereMemoryLock.java
 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/lock/ShardingSphereMemoryLock.java
deleted file mode 100644
index 437e43bc1a2..00000000000
--- 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/lock/ShardingSphereMemoryLock.java
+++ /dev/null
@@ -1,83 +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.memory.lock;
-
-import com.google.common.base.Preconditions;
-import org.apache.shardingsphere.infra.lock.ShardingSphereLock;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReentrantLock;
-
-/**
- * Memory mutex lock of ShardingSphere.
- */
-public final class ShardingSphereMemoryLock implements ShardingSphereLock {
-    
-    private static final long DEFAULT_TRY_LOCK_TIMEOUT_MILLISECONDS = 3 * 60 * 
1000;
-    
-    private final Map<String, ReentrantLock> locks = new ConcurrentHashMap<>();
-    
-    @Override
-    public boolean tryLock(final String lockName) {
-        return tryLock(lockName, DEFAULT_TRY_LOCK_TIMEOUT_MILLISECONDS);
-    }
-    
-    @Override
-    public boolean tryLock(final String lockName, final long timeoutMillis) {
-        return innerTryLock(lockName, timeoutMillis);
-    }
-    
-    private synchronized boolean innerTryLock(final String lockName, final 
long timeoutMillis) {
-        Preconditions.checkNotNull(lockName, "Try lock args lockName name can 
not be null.");
-        ReentrantLock lock = locks.get(lockName);
-        if (null == lock) {
-            lock = new MemoryMutexLock();
-            locks.put(lockName, lock);
-        }
-        return innerTryLock(lock, timeoutMillis);
-    }
-    
-    private boolean innerTryLock(final ReentrantLock lock, final long 
timeoutMillis) {
-        try {
-            return lock.tryLock(timeoutMillis, TimeUnit.MILLISECONDS);
-        } catch (final InterruptedException ignored) {
-            return false;
-        }
-    }
-    
-    @Override
-    public void releaseLock(final String lockName) {
-        Preconditions.checkNotNull(lockName, "Release lock args lockName name 
can not be null.");
-        locks.get(lockName).unlock();
-    }
-    
-    @Override
-    public boolean isLocked(final String lockName) {
-        Preconditions.checkNotNull(lockName, "Is locked args lockName name can 
not be null.");
-        if (locks.isEmpty()) {
-            return false;
-        }
-        ReentrantLock lock = locks.get(lockName);
-        if (null == lock) {
-            return false;
-        }
-        return lock.isLocked();
-    }
-}
diff --git 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/workerid/generator/MemoryWorkerIdGenerator.java
 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/workerid/generator/MemoryWorkerIdGenerator.java
deleted file mode 100644
index 9fd0b0b3f53..00000000000
--- 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/workerid/generator/MemoryWorkerIdGenerator.java
+++ /dev/null
@@ -1,33 +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.memory.workerid.generator;
-
-import org.apache.shardingsphere.infra.instance.workerid.WorkerIdGenerator;
-
-import java.util.Properties;
-
-/**
- * Worker id generator for memory mode.
- */
-public final class MemoryWorkerIdGenerator implements WorkerIdGenerator {
-    
-    @Override
-    public long generate(final Properties props) {
-        return parseWorkerId(props).orElse(DEFAULT_WORKER_ID);
-    }
-}
diff --git 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.manager.ContextManagerBuilder
 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.manager.ContextManagerBuilder
deleted file mode 100644
index a006ce27796..00000000000
--- 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.manager.ContextManagerBuilder
+++ /dev/null
@@ -1,18 +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.
-#
-
-org.apache.shardingsphere.mode.manager.memory.MemoryContextManagerBuilder
diff --git 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
index a336b99ef0f..f309cbee856 100644
--- 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
+++ 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
@@ -102,4 +102,9 @@ public final class StandaloneContextManagerBuilder 
implements ContextManagerBuil
     public String getType() {
         return "Standalone";
     }
+    
+    @Override
+    public boolean isDefault() {
+        return true;
+    }
 }
diff --git 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/workerid/generator/StandaloneWorkerIdGenerator.java
 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/workerid/generator/StandaloneWorkerIdGenerator.java
index f9aa466e941..8fce152800b 100644
--- 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/workerid/generator/StandaloneWorkerIdGenerator.java
+++ 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/workerid/generator/StandaloneWorkerIdGenerator.java
@@ -28,6 +28,6 @@ public final class StandaloneWorkerIdGenerator implements 
WorkerIdGenerator {
     
     @Override
     public long generate(final Properties props) {
-        return parseWorkerId(props).orElse(0L);
+        return parseWorkerId(props).orElse(DEFAULT_WORKER_ID);
     }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml 
b/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml
index 2a789595e87..8306f12d59f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml
@@ -68,11 +68,6 @@
             <artifactId>shardingsphere-infra-context</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-memory-mode-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-standalone-mode-core</artifactId>

Reply via email to