Return Executor instead of concrete class in FSC
authorNiklas Gustavsson <ngn@apache.org>
Sun, 11 Aug 2013 21:57:51 +0000 (23:57 +0200)
committerNiklas Gustavsson <ngn@apache.org>
Sun, 11 Aug 2013 22:14:35 +0000 (00:14 +0200)
In FtpServerContext, we should return the Executor interface as opposed
to the concrete ThreadPoolExecutor class.

FTPSERVER-445

core/src/main/java/org/apache/ftpserver/impl/DefaultFtpServerContext.java
core/src/main/java/org/apache/ftpserver/impl/FtpServerContext.java

index 731b0f5..36b320e 100644 (file)
@@ -23,7 +23,8 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.ftpserver.ConnectionConfig;
@@ -85,8 +86,8 @@ public class DefaultFtpServerContext implements FtpServerContext {
     /**
      * The thread pool executor to be used by the server using this context
      */
-    private ThreadPoolExecutor threadPoolExecutor = null;
     
+    private ExecutorService threadPoolExecutor = null;
     static {
         ADMIN_AUTHORITIES.add(new WritePermission());
         
@@ -262,7 +263,7 @@ public class DefaultFtpServerContext implements FtpServerContext {
         this.connectionConfig = connectionConfig;
     }
     
-    public synchronized ThreadPoolExecutor getThreadPoolExecutor() {
+    public synchronized Executor getThreadPoolExecutor() {
         if(threadPoolExecutor == null) {
             int maxThreads = connectionConfig.getMaxThreads();
             if(maxThreads < 1) {
index a5eb145..70868e3 100644 (file)
@@ -20,7 +20,7 @@
 package org.apache.ftpserver.impl;
 
 import java.util.Map;
-import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.Executor;
 
 import org.apache.ftpserver.ConnectionConfig;
 import org.apache.ftpserver.command.CommandFactory;
@@ -69,5 +69,5 @@ public interface FtpServerContext extends FtpletContext {
      * Returns the thread pool executor for this context.  
      * @return the thread pool executor for this context.
      */
-    ThreadPoolExecutor getThreadPoolExecutor();
+    Executor getThreadPoolExecutor();
 }