You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/11/20 01:57:09 UTC

[james-project] 41/49: [Refactoring] protocols-library: remove unused code

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

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 9c6fddbd04e7b76ad21389a6d0e88499a2c8a170
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun Nov 17 21:11:54 2019 +0700

    [Refactoring] protocols-library: remove unused code
---
 .../lib/netty/AbstractConfigurableAsyncServer.java | 10 ---
 ...bstractExecutorAwareChannelPipelineFactory.java |  7 --
 ...nabledOrderedMemoryAwareThreadPoolExecutor.java |  6 --
 .../org/apache/james/protocols/lib/PortUtil.java   | 87 ----------------------
 4 files changed, 110 deletions(-)

diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
index 83566ed..8480c5d 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
@@ -329,16 +329,6 @@ public abstract class AbstractConfigurableAsyncServer extends AbstractAsyncServe
         // override me
     }
 
-  
-    /**
-     * Return the FileSystem
-     * 
-     * @return fileSystem
-     */
-    protected FileSystem getFileSystem() {
-        return fileSystem;
-    }
-
     /**
      * Configure the helloName for the given Configuration
      * 
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractExecutorAwareChannelPipelineFactory.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractExecutorAwareChannelPipelineFactory.java
index 2bf9d51..ee32379 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractExecutorAwareChannelPipelineFactory.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractExecutorAwareChannelPipelineFactory.java
@@ -34,13 +34,6 @@ import org.jboss.netty.util.HashedWheelTimer;
 public abstract class AbstractExecutorAwareChannelPipelineFactory extends AbstractSSLAwareChannelPipelineFactory {
 
     public AbstractExecutorAwareChannelPipelineFactory(int timeout, int maxConnections, int maxConnectsPerIp,
-                                                       ChannelGroup group, ExecutionHandler eHandler,
-                                                       ChannelHandlerFactory frameHandlerFactory,
-                                                       HashedWheelTimer hashedWheelTimer) {
-        super(timeout, maxConnections, maxConnectsPerIp, group, eHandler, frameHandlerFactory, hashedWheelTimer);
-    }
-
-    public AbstractExecutorAwareChannelPipelineFactory(int timeout, int maxConnections, int maxConnectsPerIp,
                                                        ChannelGroup group, String[] enabledCipherSuites,
                                                        ExecutionHandler eHandler, ChannelHandlerFactory frameHandlerFactory,
                                                        HashedWheelTimer hashedWheelTimer) {
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/JMXEnabledOrderedMemoryAwareThreadPoolExecutor.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/JMXEnabledOrderedMemoryAwareThreadPoolExecutor.java
index 338f654..d958531 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/JMXEnabledOrderedMemoryAwareThreadPoolExecutor.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/JMXEnabledOrderedMemoryAwareThreadPoolExecutor.java
@@ -48,12 +48,6 @@ public class JMXEnabledOrderedMemoryAwareThreadPoolExecutor extends OrderedMemor
         this.jmxPath = jmxPath;
         registerMBean();
     }
-    
-    public JMXEnabledOrderedMemoryAwareThreadPoolExecutor(int corePoolSize, long maxChannelMemorySize, long maxTotalMemorySize, long keepAliveTime, TimeUnit unit, String jmxPath, String name) {
-        super(corePoolSize, maxChannelMemorySize, maxTotalMemorySize, keepAliveTime, unit, NamedThreadFactory.withName(name));
-        this.jmxPath = jmxPath;
-        registerMBean();
-    }
 
     @Override
     protected void beforeExecute(Thread t, Runnable r) {
diff --git a/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/PortUtil.java b/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/PortUtil.java
deleted file mode 100644
index 460ced3..0000000
--- a/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/PortUtil.java
+++ /dev/null
@@ -1,87 +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.james.protocols.lib;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-
-/**
- * some utilities for James unit testing
- */
-public class PortUtil {
-
-    //the lowest possible port number assigned for testing
-    private static final int PORT_RANGE_START = 8000;
-    // the highest possible port number assigned for testing
-    private static final int PORT_RANGE_END = 11000; 
-    private static int PORT_LAST_USED = PORT_RANGE_START;
-
-    /**
-     * assigns a port from the range of test ports
-     * 
-     * @return port number
-     */
-    public static int getNonPrivilegedPort() {
-        // uses sequential assignment of ports
-        return getNextNonPrivilegedPort(); 
-    }
-
-    /**
-     * assigns a random port from the range of test ports
-     * 
-     * @return port number
-     */
-    protected static int getRandomNonPrivilegedPortInt() {
-        return ((int) (Math.random() * (PORT_RANGE_END - PORT_RANGE_START) + PORT_RANGE_START));
-    }
-
-    /**
-     * assigns ports sequentially from the range of test ports
-     * 
-     * @return port number
-     */
-    protected static synchronized int getNextNonPrivilegedPort() {
-        // Hack to increase probability that the port is bindable
-        int nextPortCandidate = PORT_LAST_USED;
-        while (true) {
-            try {
-                nextPortCandidate++;
-                if (PORT_LAST_USED == nextPortCandidate) {
-                    throw new RuntimeException("no free port found");
-                }
-                if (nextPortCandidate > PORT_RANGE_END) {
-                    nextPortCandidate = PORT_RANGE_START; // start over
-                }
-
-                // test, port is available
-                ServerSocket ss;
-                ss = new ServerSocket(nextPortCandidate);
-                ss.setReuseAddress(true);
-                ss.close();
-                break;
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-        PORT_LAST_USED = nextPortCandidate;
-        return PORT_LAST_USED;
-    }
-
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org