Return Executor instead of concrete class in FSC In FtpServerContext, we should return the Executor interface as opposed to the concrete ThreadPoolExecutor class.
FTPSERVER-445 Project: http://git-wip-us.apache.org/repos/asf/mina-ftpserver/repo Commit: http://git-wip-us.apache.org/repos/asf/mina-ftpserver/commit/cd4e9e00 Tree: http://git-wip-us.apache.org/repos/asf/mina-ftpserver/tree/cd4e9e00 Diff: http://git-wip-us.apache.org/repos/asf/mina-ftpserver/diff/cd4e9e00 Branch: refs/heads/trunk Commit: cd4e9e00ff15662314e56c55f548d73440b7456b Parents: c39b822 Author: Niklas Gustavsson <[email protected]> Authored: Sun Aug 11 23:57:51 2013 +0200 Committer: Niklas Gustavsson <[email protected]> Committed: Mon Aug 12 00:14:35 2013 +0200 ---------------------------------------------------------------------- .../org/apache/ftpserver/impl/DefaultFtpServerContext.java | 7 ++++--- .../main/java/org/apache/ftpserver/impl/FtpServerContext.java | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina-ftpserver/blob/cd4e9e00/core/src/main/java/org/apache/ftpserver/impl/DefaultFtpServerContext.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/ftpserver/impl/DefaultFtpServerContext.java b/core/src/main/java/org/apache/ftpserver/impl/DefaultFtpServerContext.java index 731b0f5..36b320e 100644 --- a/core/src/main/java/org/apache/ftpserver/impl/DefaultFtpServerContext.java +++ b/core/src/main/java/org/apache/ftpserver/impl/DefaultFtpServerContext.java @@ -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) { http://git-wip-us.apache.org/repos/asf/mina-ftpserver/blob/cd4e9e00/core/src/main/java/org/apache/ftpserver/impl/FtpServerContext.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/ftpserver/impl/FtpServerContext.java b/core/src/main/java/org/apache/ftpserver/impl/FtpServerContext.java index a5eb145..70868e3 100644 --- a/core/src/main/java/org/apache/ftpserver/impl/FtpServerContext.java +++ b/core/src/main/java/org/apache/ftpserver/impl/FtpServerContext.java @@ -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(); }
