You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2020/09/07 12:09:28 UTC

[shardingsphere] branch master updated: Remove singleton for ShardingSphereProxy

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 83437cb  Remove singleton for ShardingSphereProxy
     new da0989d  Merge pull request #7295 from terrymanu/dev
83437cb is described below

commit 83437cb0c01ca460171ed6c50e34c50ad02f2b4c
Author: terrymanu <te...@163.com>
AuthorDate: Mon Sep 7 19:58:59 2020 +0800

    Remove singleton for ShardingSphereProxy
---
 .../proxy/init/impl/AbstractBootstrapInitializer.java      |  2 +-
 .../proxy/frontend/bootstrap/ShardingSphereProxy.java      | 14 --------------
 2 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/init/impl/AbstractBootstrapInitializer.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/init/impl/AbstractBootstrapInitializer.java
index 7db6479..fb47ea2 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/init/impl/AbstractBootstrapInitializer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/init/impl/AbstractBootstrapInitializer.java
@@ -56,7 +56,7 @@ public abstract class AbstractBootstrapInitializer implements BootstrapInitializ
         ProxySchemaContexts.getInstance().init(schemaContexts, transactionContexts);
         initOpenTracing();
         setDatabaseServerInfo();
-        ShardingSphereProxy.getInstance().start(port);
+        new ShardingSphereProxy().start(port);
     }
     
     private SchemaContexts createSchemaContexts(final ProxyConfiguration proxyConfig) throws SQLException {
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/bootstrap/ShardingSphereProxy.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/bootstrap/ShardingSphereProxy.java
index 977a99f..c5bc4f6 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/bootstrap/ShardingSphereProxy.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/bootstrap/ShardingSphereProxy.java
@@ -31,8 +31,6 @@ import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.channel.socket.nio.NioServerSocketChannel;
 import io.netty.handler.logging.LogLevel;
 import io.netty.handler.logging.LoggingHandler;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
 import lombok.SneakyThrows;
 import org.apache.shardingsphere.proxy.backend.executor.BackendExecutorContext;
 import org.apache.shardingsphere.proxy.frontend.netty.ServerHandlerInitializer;
@@ -40,25 +38,13 @@ import org.apache.shardingsphere.proxy.frontend.netty.ServerHandlerInitializer;
 /**
  * ShardingSphere-Proxy.
  */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
 public final class ShardingSphereProxy {
     
-    private static final ShardingSphereProxy INSTANCE = new ShardingSphereProxy();
-    
     private EventLoopGroup bossGroup;
     
     private EventLoopGroup workerGroup;
     
     /**
-     * Get instance of proxy context.
-     *
-     * @return instance of proxy context.
-     */
-    public static ShardingSphereProxy getInstance() {
-        return INSTANCE;
-    }
-    
-    /**
      * Start ShardingSphere-Proxy.
      *
      * @param port port