sunkai-cai commented on code in PR #24524:
URL: https://github.com/apache/shardingsphere/pull/24524#discussion_r1137354393


##########
proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java:
##########
@@ -63,24 +71,51 @@ public void start(final int port, final List<String> 
addresses) {
             List<ChannelFuture> futures = startInternal(port, addresses);
             accept(futures);
         } finally {
-            workerGroup.shutdownGracefully();
-            bossGroup.shutdownGracefully();
-            BackendExecutorContext.getInstance().getExecutorEngine().close();
+            close();
+        }
+    }
+    
+    /**
+     * Start ShardingSphere-Proxy with DomainSocket.
+     *
+     * @param socketPath socket path
+     */
+    public void start(final String socketPath) {
+        if (!Epoll.isAvailable()) {
+            log.error("Epoll is unavailable, DomainSocket can't start.");
+            return;
+        }
+        try {
+            ChannelFuture future = startDomainSocket(socketPath);
+            future.addListener((ChannelFutureListener) futureParams -> {
+                if (futureParams.isSuccess()) {
+                    log.info("The listening address for DomainSocket is {}", 
socketPath);
+                } else {
+                    log.error("DomainSocket failed to start.");
+                    futureParams.cause().printStackTrace();
+                }
+            });
+        } catch (final InterruptedException ignored) {
+            close();
         }
     }
     
     private List<ChannelFuture> startInternal(final int port, final 
List<String> addresses) throws InterruptedException {
-        createEventLoopGroup();
         ServerBootstrap bootstrap = new ServerBootstrap();
         initServerBootstrap(bootstrap);
-        
         List<ChannelFuture> futures = new ArrayList<>();
         for (String address : addresses) {
             futures.add(bootstrap.bind(address, port).sync());
         }
         return futures;
     }
     
+    private ChannelFuture startDomainSocket(final String socketPath) throws 
InterruptedException {

Review Comment:
   oh,it‘s not need。



##########
proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java:
##########
@@ -63,24 +71,51 @@ public void start(final int port, final List<String> 
addresses) {
             List<ChannelFuture> futures = startInternal(port, addresses);
             accept(futures);
         } finally {
-            workerGroup.shutdownGracefully();
-            bossGroup.shutdownGracefully();
-            BackendExecutorContext.getInstance().getExecutorEngine().close();
+            close();
+        }
+    }
+    
+    /**
+     * Start ShardingSphere-Proxy with DomainSocket.
+     *
+     * @param socketPath socket path
+     */
+    public void start(final String socketPath) {
+        if (!Epoll.isAvailable()) {
+            log.error("Epoll is unavailable, DomainSocket can't start.");
+            return;
+        }
+        try {
+            ChannelFuture future = startDomainSocket(socketPath);
+            future.addListener((ChannelFutureListener) futureParams -> {
+                if (futureParams.isSuccess()) {
+                    log.info("The listening address for DomainSocket is {}", 
socketPath);
+                } else {
+                    log.error("DomainSocket failed to start.");

Review Comment:
   ok



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to