Repository: mina-sshd
Updated Branches:
  refs/heads/master bba23bf70 -> 644649975


[SSHD-835] Rename to CloseableExecutorService


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/ce29eab3
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/ce29eab3
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/ce29eab3

Branch: refs/heads/master
Commit: ce29eab3368ff4fc1496e23c4b72b75ac70ca2cd
Parents: bba23bf
Author: Guillaume Nodet <gno...@apache.org>
Authored: Thu Jul 26 05:06:54 2018 +0200
Committer: Guillaume Nodet <gno...@apache.org>
Committed: Thu Jul 26 05:06:54 2018 +0200

----------------------------------------------------------------------
 .../sshd/agent/common/AbstractAgentProxy.java   | 10 +++----
 .../agent/local/ChannelAgentForwarding.java     |  4 +--
 .../org/apache/sshd/agent/unix/AgentClient.java |  6 ++---
 .../org/apache/sshd/agent/unix/AgentServer.java | 14 +++++-----
 .../sshd/agent/unix/AgentServerProxy.java       | 10 +++----
 .../sshd/agent/unix/ChannelAgentForwarding.java |  8 +++---
 .../unix/ChannelAgentForwardingFactory.java     |  8 +++---
 .../sshd/agent/unix/UnixAgentFactory.java       |  8 +++---
 .../sshd/client/channel/ChannelSession.java     |  6 ++---
 .../sshd/common/channel/AbstractChannel.java    | 10 +++----
 .../common/io/AbstractIoServiceFactory.java     | 10 +++----
 .../io/AbstractIoServiceFactoryFactory.java     | 14 +++++-----
 .../io/DefaultIoServiceFactoryFactory.java      |  6 ++---
 .../sshd/common/io/IoServiceFactoryFactory.java |  4 +--
 .../sshd/common/io/nio2/Nio2ServiceFactory.java |  4 +--
 .../io/nio2/Nio2ServiceFactoryFactory.java      |  6 ++---
 .../util/threads/CloseableExecutorService.java  | 28 ++++++++++++++++++++
 .../common/util/threads/ExecutorService.java    | 26 ------------------
 .../util/threads/ExecutorServiceCarrier.java    |  4 +--
 .../sshd/common/util/threads/ThreadUtils.java   | 27 ++++++++++---------
 .../server/channel/AbstractServerChannel.java   |  6 ++---
 .../server/command/AbstractCommandSupport.java  | 12 ++++-----
 .../command/AbstractFileSystemCommand.java      |  4 +--
 .../sshd/server/forward/TcpipServerChannel.java |  8 +++---
 .../io/DefaultIoServiceFactoryFactoryTest.java  |  6 ++---
 .../sshd/common/util/ThreadUtilsTest.java       |  6 ++---
 .../org/apache/sshd/git/AbstractGitCommand.java |  4 +--
 .../sshd/git/AbstractGitCommandFactory.java     |  8 +++---
 .../apache/sshd/git/pack/GitPackCommand.java    |  6 ++---
 .../sshd/git/pack/GitPackCommandFactory.java    |  4 +--
 .../org/apache/sshd/git/pgm/GitPgmCommand.java  |  6 ++---
 .../sshd/git/pgm/GitPgmCommandFactory.java      |  4 +--
 .../sshd/common/io/mina/MinaServiceFactory.java |  4 +--
 .../io/mina/MinaServiceFactoryFactory.java      |  6 ++---
 .../org/apache/sshd/server/scp/ScpCommand.java  |  6 ++---
 .../sshd/server/scp/ScpCommandFactory.java      | 12 ++++-----
 .../org/apache/sshd/client/scp/ScpTest.java     |  4 +--
 .../sshd/server/scp/ScpCommandFactoryTest.java  |  8 +++---
 .../server/subsystem/sftp/SftpSubsystem.java    | 16 +++++------
 .../subsystem/sftp/SftpSubsystemFactory.java    | 14 +++++-----
 .../sftp/SftpSubsystemFactoryTest.java          |  8 +++---
 41 files changed, 184 insertions(+), 181 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentProxy.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentProxy.java 
b/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentProxy.java
index 0432eec..97a858a 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentProxy.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/agent/common/AbstractAgentProxy.java
@@ -37,7 +37,7 @@ import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.BufferUtils;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
 
 /**
@@ -45,10 +45,10 @@ import 
org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
  */
 public abstract class AbstractAgentProxy extends AbstractLoggingBean 
implements SshAgent, ExecutorServiceCarrier {
 
-    private ExecutorService executor;
+    private CloseableExecutorService executor;
     private String channelType = FactoryManager.AGENT_FORWARDING_TYPE_OPENSSH;
 
-    protected AbstractAgentProxy(ExecutorService executorService) {
+    protected AbstractAgentProxy(CloseableExecutorService executorService) {
         super();
         executor = executorService;
     }
@@ -62,7 +62,7 @@ public abstract class AbstractAgentProxy extends 
AbstractLoggingBean implements
     }
 
     @Override
-    public ExecutorService getExecutorService() {
+    public CloseableExecutorService getExecutorService() {
         return executor;
     }
 
@@ -197,7 +197,7 @@ public abstract class AbstractAgentProxy extends 
AbstractLoggingBean implements
 
     @Override
     public void close() throws IOException {
-        ExecutorService service = getExecutorService();
+        CloseableExecutorService service = getExecutorService();
         if ((service != null) && (!service.isShutdown())) {
             Collection<?> runners = service.shutdownNow();
             if (log.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
 
b/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
index 0ca735b..f2f9715 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/agent/local/ChannelAgentForwarding.java
@@ -37,7 +37,7 @@ import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.server.channel.AbstractServerChannel;
 
 /**
@@ -48,7 +48,7 @@ public class ChannelAgentForwarding extends 
AbstractServerChannel {
     private SshAgent agent;
     private AgentClient client;
 
-    public ChannelAgentForwarding(ExecutorService executor) {
+    public ChannelAgentForwarding(CloseableExecutorService executor) {
         super("", Collections.emptyList(), executor);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java 
b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java
index 7f80a89..3291092 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentClient.java
@@ -29,7 +29,7 @@ import org.apache.sshd.agent.common.AbstractAgentProxy;
 import org.apache.sshd.common.SshException;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.tomcat.jni.Local;
 import org.apache.tomcat.jni.Pool;
@@ -53,7 +53,7 @@ public class AgentClient extends AbstractAgentProxy 
implements Runnable {
         this(authSocket, null);
     }
 
-    public AgentClient(String authSocket, ExecutorService executor) throws 
IOException {
+    public AgentClient(String authSocket, CloseableExecutorService executor) 
throws IOException {
         super((executor == null) ? 
ThreadUtils.newSingleThreadExecutor("AgentClient[" + authSocket + "]") : 
executor);
         this.authSocket = authSocket;
 
@@ -67,7 +67,7 @@ public class AgentClient extends AbstractAgentProxy 
implements Runnable {
             receiveBuffer = new ByteArrayBuffer();
             messages = new ArrayBlockingQueue<>(10);
 
-            ExecutorService service = getExecutorService();
+            CloseableExecutorService service = getExecutorService();
             pumper = service.submit(this);
         } catch (IOException e) {
             throw e;

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java 
b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java
index 6c6e13a..afba032 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServer.java
@@ -30,7 +30,7 @@ import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.tomcat.jni.Local;
@@ -45,7 +45,7 @@ import org.apache.tomcat.jni.Status;
 public class AgentServer extends AbstractLoggingBean implements Closeable, 
ExecutorServiceCarrier {
 
     private final SshAgent agent;
-    private final ExecutorService service;
+    private final CloseableExecutorService service;
     private Future<?> agentThread;
     private String authSocket;
     private long pool;
@@ -55,11 +55,11 @@ public class AgentServer extends AbstractLoggingBean 
implements Closeable, Execu
         this(null);
     }
 
-    public AgentServer(ExecutorService executor) {
+    public AgentServer(CloseableExecutorService executor) {
         this(new AgentImpl(), executor);
     }
 
-    public AgentServer(SshAgent agent, ExecutorService executor) {
+    public AgentServer(SshAgent agent, CloseableExecutorService executor) {
         this.agent = agent;
         this.service = (executor == null)
                 ? ThreadUtils.newSingleThreadExecutor("AgentServer[" + agent + 
"]") : executor;
@@ -70,7 +70,7 @@ public class AgentServer extends AbstractLoggingBean 
implements Closeable, Execu
     }
 
     @Override
-    public ExecutorService getExecutorService() {
+    public CloseableExecutorService getExecutorService() {
         return service;
     }
 
@@ -88,7 +88,7 @@ public class AgentServer extends AbstractLoggingBean 
implements Closeable, Execu
             throwException(result);
         }
 
-        ExecutorService executor = getExecutorService();
+        CloseableExecutorService executor = getExecutorService();
         agentThread = executor.submit(() -> {
             try {
                 while (true) {
@@ -122,7 +122,7 @@ public class AgentServer extends AbstractLoggingBean 
implements Closeable, Execu
             agentThread = null;
         }
 
-        ExecutorService executor = getExecutorService();
+        CloseableExecutorService executor = getExecutorService();
         if ((executor != null) && (!executor.isShutdown())) {
             Collection<?> runners = executor.shutdownNow();
             if (log.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java 
b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
index 4401a0d..4ed17cc 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/AgentServerProxy.java
@@ -32,7 +32,7 @@ import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.OsUtils;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.tomcat.jni.Local;
 import org.apache.tomcat.jni.Pool;
@@ -59,7 +59,7 @@ public class AgentServerProxy extends AbstractLoggingBean 
implements SshAgentSer
     private final long pool;
     private final long handle;
     private Future<?> piper;
-    private final ExecutorService pipeService;
+    private final CloseableExecutorService pipeService;
     private final AtomicBoolean open = new AtomicBoolean(true);
     private final AtomicBoolean innerFinished = new AtomicBoolean(false);
 
@@ -67,7 +67,7 @@ public class AgentServerProxy extends AbstractLoggingBean 
implements SshAgentSer
         this(service, null);
     }
 
-    public AgentServerProxy(ConnectionService service, ExecutorService 
executor) throws IOException {
+    public AgentServerProxy(ConnectionService service, 
CloseableExecutorService executor) throws IOException {
         this.service = service;
         try {
             String authSocket = AprLibrary.createLocalSocketAddress();
@@ -133,7 +133,7 @@ public class AgentServerProxy extends AbstractLoggingBean 
implements SshAgentSer
         return open.get();
     }
 
-    public ExecutorService getExecutorService() {
+    public CloseableExecutorService getExecutorService() {
         return pipeService;
     }
 
@@ -186,7 +186,7 @@ public class AgentServerProxy extends AbstractLoggingBean 
implements SshAgentSer
             piper = null;
         }
 
-        ExecutorService executor = getExecutorService();
+        CloseableExecutorService executor = getExecutorService();
         if ((executor != null) && (!executor.isShutdown())) {
             Collection<?> runners = executor.shutdownNow();
             if (debugEnabled) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
 
b/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
index 4a6a5ce..c2d3f01 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwarding.java
@@ -33,7 +33,7 @@ import org.apache.sshd.common.channel.ChannelOutputStream;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.sshd.server.channel.AbstractServerChannel;
 import org.apache.tomcat.jni.Local;
@@ -62,10 +62,10 @@ public class ChannelAgentForwarding extends 
AbstractServerChannel {
     private long pool;
     private long handle;
     private OutputStream out;
-    private ExecutorService forwardService;
+    private CloseableExecutorService forwardService;
     private Future<?> forwarder;
 
-    public ChannelAgentForwarding(ExecutorService executor) {
+    public ChannelAgentForwarding(CloseableExecutorService executor) {
         super("", Collections.emptyList(), executor);
     }
 
@@ -82,7 +82,7 @@ public class ChannelAgentForwarding extends 
AbstractServerChannel {
                 throwException(result);
             }
 
-            ExecutorService service = getExecutorService();
+            CloseableExecutorService service = getExecutorService();
             forwardService = (service == null)
                     ? 
ThreadUtils.newSingleThreadExecutor("ChannelAgentForwarding[" + authSocket + 
"]")
                     : ThreadUtils.noClose(service);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwardingFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwardingFactory.java
 
b/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwardingFactory.java
index e4d37d8..6811770 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwardingFactory.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/agent/unix/ChannelAgentForwardingFactory.java
@@ -22,7 +22,7 @@ import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.channel.Channel;
 import org.apache.sshd.common.channel.ChannelFactory;
 import org.apache.sshd.common.util.ValidateUtils;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 
 /**
  * @author <a href="mailto:d...@mina.apache.org";>Apache MINA SSHD Project</a>
@@ -34,13 +34,13 @@ public class ChannelAgentForwardingFactory implements 
ChannelFactory {
     public static final ChannelAgentForwardingFactory IETF = new 
ChannelAgentForwardingFactory("auth-agent");
 
     private final String name;
-    private final Factory<ExecutorService> executorServiceFactory;
+    private final Factory<CloseableExecutorService> executorServiceFactory;
 
     public ChannelAgentForwardingFactory(String name) {
         this(name, null);
     }
 
-    public ChannelAgentForwardingFactory(String name, Factory<ExecutorService> 
executorServiceFactory) {
+    public ChannelAgentForwardingFactory(String name, 
Factory<CloseableExecutorService> executorServiceFactory) {
         this.name = ValidateUtils.checkNotNullAndNotEmpty(name, "No channel 
factory name specified");
         this.executorServiceFactory = executorServiceFactory;
     }
@@ -52,7 +52,7 @@ public class ChannelAgentForwardingFactory implements 
ChannelFactory {
 
     @Override
     public Channel create() {
-        ExecutorService executorService = executorServiceFactory != null ? 
executorServiceFactory.create() : null;
+        CloseableExecutorService executorService = executorServiceFactory != 
null ? executorServiceFactory.create() : null;
         ChannelAgentForwarding channel = new 
ChannelAgentForwarding(executorService);
         return channel;
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/agent/unix/UnixAgentFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/agent/unix/UnixAgentFactory.java 
b/sshd-core/src/main/java/org/apache/sshd/agent/unix/UnixAgentFactory.java
index 02c4f62..d7f37ed 100644
--- a/sshd-core/src/main/java/org/apache/sshd/agent/unix/UnixAgentFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/agent/unix/UnixAgentFactory.java
@@ -37,7 +37,7 @@ import org.apache.sshd.common.session.ConnectionService;
 import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.server.session.ServerSession;
 
 /**
@@ -48,17 +48,17 @@ public class UnixAgentFactory implements SshAgentFactory {
             Collections.unmodifiableList(
                     
Arrays.<NamedFactory<Channel>>asList(ChannelAgentForwardingFactory.OPENSSH, 
ChannelAgentForwardingFactory.IETF));
 
-    private Factory<ExecutorService> executorServiceFactory;
+    private Factory<CloseableExecutorService> executorServiceFactory;
 
     public UnixAgentFactory() {
         super();
     }
 
-    public UnixAgentFactory(Factory<ExecutorService> factory) {
+    public UnixAgentFactory(Factory<CloseableExecutorService> factory) {
         executorServiceFactory = factory;
     }
 
-    protected ExecutorService newExecutor() {
+    protected CloseableExecutorService newExecutor() {
         return executorServiceFactory != null ? 
executorServiceFactory.create() : null;
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java 
b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java
index 1b3ff6f..f30784e 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ChannelSession.java
@@ -35,7 +35,7 @@ import org.apache.sshd.common.future.CloseFuture;
 import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 
 /**
@@ -45,7 +45,7 @@ import org.apache.sshd.common.util.threads.ThreadUtils;
  */
 public class ChannelSession extends AbstractClientChannel {
 
-    private ExecutorService pumperService;
+    private CloseableExecutorService pumperService;
     private Future<?> pumper;
 
     public ChannelSession() {
@@ -89,7 +89,7 @@ public class ChannelSession extends AbstractClientChannel {
 
             if (in != null) {
                 // allocate a temporary executor service if none provided
-                ExecutorService service = getExecutorService();
+                CloseableExecutorService service = getExecutorService();
                 if (service == null) {
                     pumperService = 
ThreadUtils.newSingleThreadExecutor("ClientInputStreamPump[" + this.toString() 
+ "]");
                 } else {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java 
b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
index b1f018e..085bd41 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
@@ -58,7 +58,7 @@ import org.apache.sshd.common.util.buffer.BufferUtils;
 import org.apache.sshd.common.util.closeable.AbstractInnerCloseable;
 import org.apache.sshd.common.util.closeable.IoBaseCloseable;
 import org.apache.sshd.common.util.io.IoUtils;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
 
 /**
@@ -94,7 +94,7 @@ public abstract class AbstractChannel
     private int id = -1;
     private int recipient = -1;
     private Session sessionInstance;
-    private ExecutorService executor;
+    private CloseableExecutorService executor;
     private final List<RequestHandler<Channel>> requestHandlers = new 
CopyOnWriteArrayList<>();
 
     private final Window localWindow;
@@ -121,7 +121,7 @@ public abstract class AbstractChannel
         this(discriminator, client, Collections.emptyList(), null);
     }
 
-    protected AbstractChannel(String discriminator, boolean client, 
Collection<? extends RequestHandler<Channel>> handlers, ExecutorService 
executorService) {
+    protected AbstractChannel(String discriminator, boolean client, 
Collection<? extends RequestHandler<Channel>> handlers, 
CloseableExecutorService executorService) {
         super(discriminator);
         gracefulFuture = new DefaultCloseFuture(discriminator, lock);
         localWindow = new Window(this, null, client, true);
@@ -184,7 +184,7 @@ public abstract class AbstractChannel
     }
 
     @Override
-    public ExecutorService getExecutorService() {
+    public CloseableExecutorService getExecutorService() {
         return executor;
     }
 
@@ -635,7 +635,7 @@ public abstract class AbstractChannel
                 }
             }
 
-            ExecutorService service = getExecutorService();
+            CloseableExecutorService service = getExecutorService();
             if ((service != null) && (!service.isShutdown())) {
                 Collection<?> running = service.shutdownNow();
                 if (debugEnabled) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/common/io/AbstractIoServiceFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/io/AbstractIoServiceFactory.java
 
b/sshd-core/src/main/java/org/apache/sshd/common/io/AbstractIoServiceFactory.java
index 243416c..b15262f 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/common/io/AbstractIoServiceFactory.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/common/io/AbstractIoServiceFactory.java
@@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.FactoryManagerHolder;
 import org.apache.sshd.common.util.closeable.AbstractCloseable;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
 
 /**
@@ -36,9 +36,9 @@ public abstract class AbstractIoServiceFactory
                 implements IoServiceFactory, FactoryManagerHolder, 
ExecutorServiceCarrier {
 
     private final FactoryManager manager;
-    private final ExecutorService executor;
+    private final CloseableExecutorService executor;
 
-    protected AbstractIoServiceFactory(FactoryManager factoryManager, 
ExecutorService executorService) {
+    protected AbstractIoServiceFactory(FactoryManager factoryManager, 
CloseableExecutorService executorService) {
         manager = Objects.requireNonNull(factoryManager);
         executor = Objects.requireNonNull(executorService);
     }
@@ -49,14 +49,14 @@ public abstract class AbstractIoServiceFactory
     }
 
     @Override
-    public final ExecutorService getExecutorService() {
+    public final CloseableExecutorService getExecutorService() {
         return executor;
     }
 
     @Override
     protected void doCloseImmediately() {
         try {
-            ExecutorService service = getExecutorService();
+            CloseableExecutorService service = getExecutorService();
             if ((service != null) && (!service.isShutdown())) {
                 log.debug("Shutdown executor");
                 service.shutdownNow();

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/common/io/AbstractIoServiceFactoryFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/io/AbstractIoServiceFactoryFactory.java
 
b/sshd-core/src/main/java/org/apache/sshd/common/io/AbstractIoServiceFactoryFactory.java
index 91f3942..a78c880 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/common/io/AbstractIoServiceFactoryFactory.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/common/io/AbstractIoServiceFactoryFactory.java
@@ -21,7 +21,7 @@ package org.apache.sshd.common.io;
 
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 
 /**
  * @author <a href="mailto:d...@mina.apache.org";>Apache MINA SSHD Project</a>
@@ -30,26 +30,26 @@ public abstract class AbstractIoServiceFactoryFactory
         extends AbstractLoggingBean
         implements IoServiceFactoryFactory {
 
-    private Factory<ExecutorService> executorServiceFactory;
+    private Factory<CloseableExecutorService> executorServiceFactory;
 
     /**
-     * @param factory      The {@link ExecutorService} factory to use for 
spawning threads.
+     * @param factory      The {@link CloseableExecutorService} factory to use 
for spawning threads.
      *                     If {@code null} then an internal service will be 
allocated.
      */
-    protected AbstractIoServiceFactoryFactory(Factory<ExecutorService> 
factory) {
+    protected 
AbstractIoServiceFactoryFactory(Factory<CloseableExecutorService> factory) {
         executorServiceFactory = factory;
     }
 
-    public Factory<ExecutorService> getExecutorServiceFactory() {
+    public Factory<CloseableExecutorService> getExecutorServiceFactory() {
         return executorServiceFactory;
     }
 
     @Override
-    public void setExecutorServiceFactory(Factory<ExecutorService> factory) {
+    public void setExecutorServiceFactory(Factory<CloseableExecutorService> 
factory) {
         executorServiceFactory = factory;
     }
 
-    protected ExecutorService newExecutor() {
+    protected CloseableExecutorService newExecutor() {
         return executorServiceFactory != null ? 
executorServiceFactory.create() : null;
     }
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java
 
b/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java
index f30331a..62ae203 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactory.java
@@ -24,7 +24,7 @@ import java.util.ServiceLoader;
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -40,7 +40,7 @@ public class DefaultIoServiceFactoryFactory extends 
AbstractIoServiceFactoryFact
         this(null);
     }
 
-    protected DefaultIoServiceFactoryFactory(Factory<ExecutorService> factory) 
{
+    protected DefaultIoServiceFactoryFactory(Factory<CloseableExecutorService> 
factory) {
         super(factory);
     }
 
@@ -57,7 +57,7 @@ public class DefaultIoServiceFactoryFactory extends 
AbstractIoServiceFactoryFact
         synchronized (this) {
             if (factory == null) {
                 factory = newInstance(IoServiceFactoryFactory.class);
-                Factory<ExecutorService> executorServiceFactory = 
getExecutorServiceFactory();
+                Factory<CloseableExecutorService> executorServiceFactory = 
getExecutorServiceFactory();
                 if (executorServiceFactory != null) {
                     factory.setExecutorServiceFactory(executorServiceFactory);
                 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/common/io/IoServiceFactoryFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/io/IoServiceFactoryFactory.java
 
b/sshd-core/src/main/java/org/apache/sshd/common/io/IoServiceFactoryFactory.java
index 74b2237..07ecb8c 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/common/io/IoServiceFactoryFactory.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/common/io/IoServiceFactoryFactory.java
@@ -20,7 +20,7 @@ package org.apache.sshd.common.io;
 
 import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 
 /**
  * @author <a href="mailto:d...@mina.apache.org";>Apache MINA SSHD Project</a>
@@ -29,5 +29,5 @@ public interface IoServiceFactoryFactory {
 
     IoServiceFactory create(FactoryManager manager);
 
-    void setExecutorServiceFactory(Factory<ExecutorService> factory);
+    void setExecutorServiceFactory(Factory<CloseableExecutorService> factory);
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2ServiceFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2ServiceFactory.java
 
b/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2ServiceFactory.java
index 12fd522..80c047f 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2ServiceFactory.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2ServiceFactory.java
@@ -28,7 +28,7 @@ import org.apache.sshd.common.io.AbstractIoServiceFactory;
 import org.apache.sshd.common.io.IoAcceptor;
 import org.apache.sshd.common.io.IoConnector;
 import org.apache.sshd.common.io.IoHandler;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 
 /**
@@ -38,7 +38,7 @@ public class Nio2ServiceFactory extends 
AbstractIoServiceFactory {
 
     private final AsynchronousChannelGroup group;
 
-    public Nio2ServiceFactory(FactoryManager factoryManager, ExecutorService 
service) {
+    public Nio2ServiceFactory(FactoryManager factoryManager, 
CloseableExecutorService service) {
         super(factoryManager,
               ThreadUtils.newFixedThreadPoolIf(service, 
factoryManager.toString() + "-nio2", getNioWorkers(factoryManager)));
         try {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2ServiceFactoryFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2ServiceFactoryFactory.java
 
b/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2ServiceFactoryFactory.java
index d99874c..478f152 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2ServiceFactoryFactory.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/common/io/nio2/Nio2ServiceFactoryFactory.java
@@ -25,7 +25,7 @@ import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.io.AbstractIoServiceFactoryFactory;
 import org.apache.sshd.common.io.IoServiceFactory;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 
 /**
  */
@@ -36,12 +36,12 @@ public class Nio2ServiceFactoryFactory extends 
AbstractIoServiceFactoryFactory {
     }
 
     /**
-     * @param executors      The {@link ExecutorService} to use for spawning 
threads.
+     * @param executors      The {@link CloseableExecutorService} to use for 
spawning threads.
      *                       If {@code null} then an internal service is 
allocated - in which case it
      *                       is automatically shutdown regardless of the value 
of the <tt>shutdownOnExit</tt>
      *                       parameter value
      */
-    public Nio2ServiceFactoryFactory(Factory<ExecutorService> executors) {
+    public Nio2ServiceFactoryFactory(Factory<CloseableExecutorService> 
executors) {
         super(executors);
         // Make sure NIO2 is available
         Objects.requireNonNull(AsynchronousChannel.class, "Missing NIO2 
class");

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/common/util/threads/CloseableExecutorService.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/CloseableExecutorService.java
 
b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/CloseableExecutorService.java
new file mode 100644
index 0000000..699507c
--- /dev/null
+++ 
b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/CloseableExecutorService.java
@@ -0,0 +1,28 @@
+/*
+ * 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.sshd.common.util.threads;
+
+import java.util.concurrent.ExecutorService;
+
+import org.apache.sshd.common.Closeable;
+
+public interface CloseableExecutorService extends ExecutorService, Closeable {
+
+}

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ExecutorService.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ExecutorService.java
 
b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ExecutorService.java
deleted file mode 100644
index fe7ccbe..0000000
--- 
a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ExecutorService.java
+++ /dev/null
@@ -1,26 +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.sshd.common.util.threads;
-
-import org.apache.sshd.common.Closeable;
-
-public interface ExecutorService extends java.util.concurrent.ExecutorService, 
Closeable {
-
-}

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ExecutorServiceCarrier.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ExecutorServiceCarrier.java
 
b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ExecutorServiceCarrier.java
index 7e9378b..b44bd46 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ExecutorServiceCarrier.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ExecutorServiceCarrier.java
@@ -24,8 +24,8 @@ package org.apache.sshd.common.util.threads;
  */
 public interface ExecutorServiceCarrier {
     /**
-     * @return The {@link ExecutorService} to use
+     * @return The {@link CloseableExecutorService} to use
      */
-    ExecutorService getExecutorService();
+    CloseableExecutorService getExecutorService();
 
 }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java 
b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
index 34a935b..66b5cd2 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/common/util/threads/ThreadUtils.java
@@ -30,6 +30,7 @@ import java.util.Set;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.RejectedExecutionHandler;
@@ -59,11 +60,11 @@ public final class ThreadUtils {
     }
 
     /**
-     * Wraps an {@link ExecutorService} in such a way as to &quot;protect&quot;
-     * it for calls to the {@link ExecutorService#shutdown()} or
-     * {@link ExecutorService#shutdownNow()}. All other calls are delegated 
as-is
+     * Wraps an {@link CloseableExecutorService} in such a way as to 
&quot;protect&quot;
+     * it for calls to the {@link CloseableExecutorService#shutdown()} or
+     * {@link CloseableExecutorService#shutdownNow()}. All other calls are 
delegated as-is
      * to the original service. <B>Note:</B> the exposed wrapped proxy will
-     * answer correctly the {@link ExecutorService#isShutdown()} query if 
indeed
+     * answer correctly the {@link CloseableExecutorService#isShutdown()} 
query if indeed
      * one of the {@code shutdown} methods was invoked.
      *
      * @param executorService The original service - ignored if {@code null}
@@ -72,7 +73,7 @@ public final class ThreadUtils {
      * @return Either the original service or a wrapped one - depending on the
      * value of the <tt>shutdownOnExit</tt> parameter
      */
-    public static ExecutorService protectExecutorServiceShutdown(final 
ExecutorService executorService, boolean shutdownOnExit) {
+    public static CloseableExecutorService 
protectExecutorServiceShutdown(final CloseableExecutorService executorService, 
boolean shutdownOnExit) {
         if (executorService == null || shutdownOnExit || executorService 
instanceof NoCloseExecutor) {
             return executorService;
         } else {
@@ -80,7 +81,7 @@ public final class ThreadUtils {
         }
     }
 
-    public static ExecutorService noClose(ExecutorService executorService) {
+    public static CloseableExecutorService noClose(CloseableExecutorService 
executorService) {
         return protectExecutorServiceShutdown(executorService, false);
     }
 
@@ -170,11 +171,11 @@ public final class ThreadUtils {
         return cls;
     }
 
-    public static ExecutorService newFixedThreadPoolIf(ExecutorService 
executorService, String poolName, int nThreads) {
+    public static CloseableExecutorService 
newFixedThreadPoolIf(CloseableExecutorService executorService, String poolName, 
int nThreads) {
         return executorService == null ? newFixedThreadPool(poolName, 
nThreads) : executorService;
     }
 
-    public static ExecutorService newFixedThreadPool(String poolName, int 
nThreads) {
+    public static CloseableExecutorService newFixedThreadPool(String poolName, 
int nThreads) {
         return new ThreadPoolExecutor(
                 nThreads, nThreads,
                 0L, TimeUnit.MILLISECONDS, // TODO make this configurable
@@ -183,11 +184,11 @@ public final class ThreadUtils {
                 new ThreadPoolExecutor.CallerRunsPolicy());
     }
 
-    public static ExecutorService newCachedThreadPoolIf(ExecutorService 
executorService, String poolName) {
+    public static CloseableExecutorService 
newCachedThreadPoolIf(CloseableExecutorService executorService, String 
poolName) {
         return executorService == null ? newCachedThreadPool(poolName) : 
executorService;
     }
 
-    public static ExecutorService newCachedThreadPool(String poolName) {
+    public static CloseableExecutorService newCachedThreadPool(String 
poolName) {
         return new ThreadPoolExecutor(
                 0, Integer.MAX_VALUE, // TODO make this configurable
                 60L, TimeUnit.SECONDS, // TODO make this configurable
@@ -200,7 +201,7 @@ public final class ThreadUtils {
         return new ScheduledThreadPoolExecutor(1, new 
SshdThreadFactory(poolName));
     }
 
-    public static ExecutorService newSingleThreadExecutor(String poolName) {
+    public static CloseableExecutorService newSingleThreadExecutor(String 
poolName) {
         return newFixedThreadPool(poolName, 1);
     }
 
@@ -249,7 +250,7 @@ public final class ThreadUtils {
         }
     }
 
-    public static class NoCloseExecutor implements ExecutorService {
+    public static class NoCloseExecutor implements CloseableExecutorService {
 
         protected final ExecutorService executor;
         protected final CloseFuture closeFuture;
@@ -357,7 +358,7 @@ public final class ThreadUtils {
 
     }
 
-    public static class ThreadPoolExecutor extends 
java.util.concurrent.ThreadPoolExecutor implements ExecutorService {
+    public static class ThreadPoolExecutor extends 
java.util.concurrent.ThreadPoolExecutor implements CloseableExecutorService {
 
         final DelegateCloseable closeable = new DelegateCloseable();
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
 
b/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
index b9da5a7..5e12821 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
@@ -35,7 +35,7 @@ import org.apache.sshd.common.channel.Window;
 import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.buffer.Buffer;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.server.session.ServerSession;
 
 /**
@@ -47,11 +47,11 @@ public abstract class AbstractServerChannel extends 
AbstractChannel implements S
 
     protected final AtomicBoolean exitStatusSent = new AtomicBoolean(false);
 
-    protected AbstractServerChannel(ExecutorService executor) {
+    protected AbstractServerChannel(CloseableExecutorService executor) {
         super("", false, Collections.emptyList(), executor);
     }
 
-    protected AbstractServerChannel(String discriminator, Collection<? extends 
RequestHandler<Channel>> handlers, ExecutorService executor) {
+    protected AbstractServerChannel(String discriminator, Collection<? extends 
RequestHandler<Channel>> handlers, CloseableExecutorService executor) {
         super(discriminator, false, handlers, executor);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractCommandSupport.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractCommandSupport.java
 
b/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractCommandSupport.java
index 8704a4a..54b6ffd 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractCommandSupport.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractCommandSupport.java
@@ -29,7 +29,7 @@ import org.apache.sshd.common.session.Session;
 import org.apache.sshd.common.session.SessionHolder;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.sshd.server.Environment;
@@ -55,11 +55,11 @@ public abstract class AbstractCommandSupport
     protected Environment environment;
     protected Future<?> cmdFuture;
     protected Thread cmdRunner;
-    protected ExecutorService executorService;
+    protected CloseableExecutorService executorService;
     protected boolean cbCalled;
     protected ServerSession serverSession;
 
-    protected AbstractCommandSupport(String command, ExecutorService 
executorService) {
+    protected AbstractCommandSupport(String command, CloseableExecutorService 
executorService) {
         this.command = command;
 
         if (executorService == null) {
@@ -90,7 +90,7 @@ public abstract class AbstractCommandSupport
     }
 
     @Override
-    public ExecutorService getExecutorService() {
+    public CloseableExecutorService getExecutorService() {
         return executorService;
     }
 
@@ -142,7 +142,7 @@ public abstract class AbstractCommandSupport
     public void start(Environment env) throws IOException {
         environment = env;
         try {
-            ExecutorService executors = getExecutorService();
+            CloseableExecutorService executors = getExecutorService();
             cmdFuture = executors.submit(() -> {
                 cmdRunner = Thread.currentThread();
                 this.run();
@@ -167,7 +167,7 @@ public abstract class AbstractCommandSupport
 
         cmdFuture = null;
 
-        ExecutorService executors = getExecutorService();
+        CloseableExecutorService executors = getExecutorService();
         if ((executors != null) && (!executors.isShutdown())) {
             Collection<Runnable> runners = executors.shutdownNow();
             if (debugEnabled) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractFileSystemCommand.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractFileSystemCommand.java
 
b/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractFileSystemCommand.java
index 6722976..b1049e1 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractFileSystemCommand.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/server/command/AbstractFileSystemCommand.java
@@ -23,7 +23,7 @@ import java.io.IOException;
 import java.nio.file.FileSystem;
 
 import org.apache.sshd.common.file.FileSystemAware;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 
 /**
  * Provides a basic useful skeleton for {@link Command} executions that 
require file system access
@@ -34,7 +34,7 @@ public abstract class AbstractFileSystemCommand extends 
AbstractCommandSupport i
 
     protected FileSystem fileSystem;
 
-    public AbstractFileSystemCommand(String command, ExecutorService 
executorService) {
+    public AbstractFileSystemCommand(String command, CloseableExecutorService 
executorService) {
         super(command, executorService);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
 
b/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
index e7eef13..d6fd3af 100644
--- 
a/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
+++ 
b/sshd-core/src/main/java/org/apache/sshd/server/forward/TcpipServerChannel.java
@@ -51,7 +51,7 @@ import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
 import org.apache.sshd.common.util.closeable.AbstractCloseable;
 import org.apache.sshd.common.util.net.SshdSocketAddress;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.sshd.server.channel.AbstractServerChannel;
@@ -82,7 +82,7 @@ public class TcpipServerChannel extends AbstractServerChannel 
implements Forward
         }
 
         @Override
-        public ExecutorService getExecutorService() {
+        public CloseableExecutorService getExecutorService() {
             return null;
         }
 
@@ -102,7 +102,7 @@ public class TcpipServerChannel extends 
AbstractServerChannel implements Forward
     private SshdSocketAddress originatorAddress;
     private SocketAddress localAddress;
 
-    public TcpipServerChannel(ForwardingFilter.Type type, ExecutorService 
executor) {
+    public TcpipServerChannel(ForwardingFilter.Type type, 
CloseableExecutorService executor) {
         super("", Collections.emptyList(), executor);
         this.type = Objects.requireNonNull(type, "No channel type specified");
     }
@@ -314,7 +314,7 @@ public class TcpipServerChannel extends 
AbstractServerChannel implements Forward
                 })
                 .close(super.getInnerCloseable())
                 .close(new AbstractCloseable() {
-                    ExecutorService executor = 
ThreadUtils.newCachedThreadPool("TcpIpServerChannel-ConnectorCleanup[" + 
getSession() + "]");
+                    CloseableExecutorService executor = 
ThreadUtils.newCachedThreadPool("TcpIpServerChannel-ConnectorCleanup[" + 
getSession() + "]");
                     @Override
                     protected CloseFuture doCloseGracefully() {
                         executor.submit(() -> {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
 
b/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
index ebf4284..26f9dfa 100644
--- 
a/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
+++ 
b/sshd-core/src/test/java/org/apache/sshd/common/io/DefaultIoServiceFactoryFactoryTest.java
@@ -22,7 +22,7 @@ package org.apache.sshd.common.io;
 import java.util.Collections;
 
 import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
@@ -56,7 +56,7 @@ public class DefaultIoServiceFactoryFactoryTest extends 
BaseTestSupport {
     @SuppressWarnings("boxing")
     @Test
     public void testExecutorServiceInitialization() throws Exception {
-        ExecutorService service = Mockito.mock(ExecutorService.class);
+        CloseableExecutorService service = 
Mockito.mock(CloseableExecutorService.class);
         
Mockito.when(service.shutdownNow()).thenReturn(Collections.emptyList());
         Mockito.when(service.isShutdown()).thenReturn(Boolean.TRUE);
         Mockito.when(service.isTerminated()).thenReturn(Boolean.TRUE);
@@ -76,7 +76,7 @@ public class DefaultIoServiceFactoryFactoryTest extends 
BaseTestSupport {
 
                 try (IoServiceFactory factory = 
defaultFactory.create(manager)) {
 
-                    ExecutorService svc = (ExecutorService) 
factory.getClass().getMethod("getExecutorService").invoke(factory);
+                    CloseableExecutorService svc = (CloseableExecutorService) 
factory.getClass().getMethod("getExecutorService").invoke(factory);
                     assertSame(name + " - mismatched executor service", 
service, svc);
                 } catch (NoSuchMethodException e) {
                     // ignore if there's no executor service

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-core/src/test/java/org/apache/sshd/common/util/ThreadUtilsTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-core/src/test/java/org/apache/sshd/common/util/ThreadUtilsTest.java 
b/sshd-core/src/test/java/org/apache/sshd/common/util/ThreadUtilsTest.java
index 09f3bb0..50fda34 100644
--- a/sshd-core/src/test/java/org/apache/sshd/common/util/ThreadUtilsTest.java
+++ b/sshd-core/src/test/java/org/apache/sshd/common/util/ThreadUtilsTest.java
@@ -21,7 +21,7 @@ package org.apache.sshd.common.util;
 
 import java.util.Collection;
 
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.apache.sshd.util.test.NoIoTestCase;
@@ -46,11 +46,11 @@ public class ThreadUtilsTest extends BaseTestSupport {
             assertNull("Unexpected instance for shutdown=" + shutdownOnExit, 
ThreadUtils.protectExecutorServiceShutdown(null, shutdownOnExit));
         }
 
-        ExecutorService service = ThreadUtils.newSingleThreadExecutor("pool");
+        CloseableExecutorService service = 
ThreadUtils.newSingleThreadExecutor("pool");
         try {
             assertSame("Unexpected wrapped instance", service, 
ThreadUtils.protectExecutorServiceShutdown(service, true));
 
-            ExecutorService wrapped = 
ThreadUtils.protectExecutorServiceShutdown(service, false);
+            CloseableExecutorService wrapped = 
ThreadUtils.protectExecutorServiceShutdown(service, false);
             try {
                 assertNotSame("No wrapping occurred", service, wrapped);
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-git/src/main/java/org/apache/sshd/git/AbstractGitCommand.java
----------------------------------------------------------------------
diff --git a/sshd-git/src/main/java/org/apache/sshd/git/AbstractGitCommand.java 
b/sshd-git/src/main/java/org/apache/sshd/git/AbstractGitCommand.java
index cb75a3a..405d3c9 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/AbstractGitCommand.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/AbstractGitCommand.java
@@ -26,7 +26,7 @@ import java.util.List;
 import java.util.Objects;
 
 import org.apache.sshd.common.channel.ChannelOutputStream;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.server.command.AbstractFileSystemCommand;
 
 /**
@@ -45,7 +45,7 @@ public abstract class AbstractGitCommand
     protected final GitLocationResolver rootDirResolver;
     protected FileSystem fileSystem;
 
-    protected AbstractGitCommand(GitLocationResolver rootDirResolver, String 
command, ExecutorService executorService) {
+    protected AbstractGitCommand(GitLocationResolver rootDirResolver, String 
command, CloseableExecutorService executorService) {
         super(command, executorService);
         this.rootDirResolver = Objects.requireNonNull(rootDirResolver, "No GIT 
root directory resolver provided");
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-git/src/main/java/org/apache/sshd/git/AbstractGitCommandFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-git/src/main/java/org/apache/sshd/git/AbstractGitCommandFactory.java 
b/sshd-git/src/main/java/org/apache/sshd/git/AbstractGitCommandFactory.java
index b0cb79f..dd0cb3c 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/AbstractGitCommandFactory.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/AbstractGitCommandFactory.java
@@ -21,7 +21,7 @@ package org.apache.sshd.git;
 
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
 import org.apache.sshd.server.command.AbstractDelegatingCommandFactory;
 import org.apache.sshd.server.command.Command;
@@ -38,7 +38,7 @@ public abstract class AbstractGitCommandFactory
         implements ExecutorServiceCarrier, GitLocationResolverCarrier {
     private final String cmdPrefix;
     private GitLocationResolver rootDirResolver;
-    private ExecutorService executorService;
+    private CloseableExecutorService executorService;
 
     /**
      * @param name Command factory logical name
@@ -56,11 +56,11 @@ public abstract class AbstractGitCommandFactory
     }
 
     @Override
-    public ExecutorService getExecutorService() {
+    public CloseableExecutorService getExecutorService() {
         return executorService;
     }
 
-    public AbstractGitCommandFactory withExecutorService(ExecutorService 
executorService) {
+    public AbstractGitCommandFactory 
withExecutorService(CloseableExecutorService executorService) {
         this.executorService = executorService;
         return this;
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommand.java
----------------------------------------------------------------------
diff --git 
a/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommand.java 
b/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommand.java
index 565f88b..49c0181 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommand.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommand.java
@@ -24,7 +24,7 @@ import java.util.List;
 
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ValidateUtils;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.git.AbstractGitCommand;
 import org.apache.sshd.git.GitLocationResolver;
 import org.apache.sshd.server.Environment;
@@ -44,10 +44,10 @@ public class GitPackCommand extends AbstractGitCommand {
     /**
      * @param rootDirResolver Resolver for GIT root directory
      * @param command Command to execute
-     * @param executorService An {@link ExecutorService} to be used when 
{@link #start(Environment)}-ing
+     * @param executorService An {@link CloseableExecutorService} to be used 
when {@link #start(Environment)}-ing
      * execution. If {@code null} an ad-hoc single-threaded service is created 
and used.
      */
-    public GitPackCommand(GitLocationResolver rootDirResolver, String command, 
ExecutorService executorService) {
+    public GitPackCommand(GitLocationResolver rootDirResolver, String command, 
CloseableExecutorService executorService) {
         super(rootDirResolver, command, executorService);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommandFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommandFactory.java 
b/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommandFactory.java
index 5548df6..7c12459 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommandFactory.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/pack/GitPackCommandFactory.java
@@ -18,7 +18,7 @@
  */
 package org.apache.sshd.git.pack;
 
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.git.AbstractGitCommandFactory;
 import org.apache.sshd.git.GitLocationResolver;
 import org.apache.sshd.server.command.CommandFactory;
@@ -52,7 +52,7 @@ public class GitPackCommandFactory extends 
AbstractGitCommandFactory {
     }
 
     @Override
-    public GitPackCommandFactory withExecutorService(ExecutorService 
executorService) {
+    public GitPackCommandFactory withExecutorService(CloseableExecutorService 
executorService) {
         return (GitPackCommandFactory) 
super.withExecutorService(executorService);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-git/src/main/java/org/apache/sshd/git/pgm/GitPgmCommand.java
----------------------------------------------------------------------
diff --git a/sshd-git/src/main/java/org/apache/sshd/git/pgm/GitPgmCommand.java 
b/sshd-git/src/main/java/org/apache/sshd/git/pgm/GitPgmCommand.java
index c827057..ea828dc 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/pgm/GitPgmCommand.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/pgm/GitPgmCommand.java
@@ -25,7 +25,7 @@ import java.nio.file.Path;
 import java.util.List;
 
 import org.apache.sshd.common.util.ValidateUtils;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.git.AbstractGitCommand;
 import org.apache.sshd.git.GitLocationResolver;
 import org.apache.sshd.server.Environment;
@@ -39,10 +39,10 @@ public class GitPgmCommand extends AbstractGitCommand {
     /**
      * @param rootDirResolver Resolver for GIT root directory
      * @param command Command to execute
-     * @param executorService An {@link ExecutorService} to be used when 
{@link #start(Environment)}-ing
+     * @param executorService An {@link CloseableExecutorService} to be used 
when {@link #start(Environment)}-ing
      * execution. If {@code null} an ad-hoc single-threaded service is created 
and used.
      */
-    public GitPgmCommand(GitLocationResolver rootDirResolver, String command, 
ExecutorService executorService) {
+    public GitPgmCommand(GitLocationResolver rootDirResolver, String command, 
CloseableExecutorService executorService) {
         super(rootDirResolver, command, executorService);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-git/src/main/java/org/apache/sshd/git/pgm/GitPgmCommandFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-git/src/main/java/org/apache/sshd/git/pgm/GitPgmCommandFactory.java 
b/sshd-git/src/main/java/org/apache/sshd/git/pgm/GitPgmCommandFactory.java
index b68cb00..ad805f1 100644
--- a/sshd-git/src/main/java/org/apache/sshd/git/pgm/GitPgmCommandFactory.java
+++ b/sshd-git/src/main/java/org/apache/sshd/git/pgm/GitPgmCommandFactory.java
@@ -18,7 +18,7 @@
  */
 package org.apache.sshd.git.pgm;
 
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.git.AbstractGitCommandFactory;
 import org.apache.sshd.git.GitLocationResolver;
 import org.apache.sshd.server.command.CommandFactory;
@@ -52,7 +52,7 @@ public class GitPgmCommandFactory extends 
AbstractGitCommandFactory {
     }
 
     @Override
-    public GitPgmCommandFactory withExecutorService(ExecutorService 
executorService) {
+    public GitPgmCommandFactory withExecutorService(CloseableExecutorService 
executorService) {
         return (GitPgmCommandFactory) 
super.withExecutorService(executorService);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-mina/src/main/java/org/apache/sshd/common/io/mina/MinaServiceFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-mina/src/main/java/org/apache/sshd/common/io/mina/MinaServiceFactory.java
 
b/sshd-mina/src/main/java/org/apache/sshd/common/io/mina/MinaServiceFactory.java
index 2931566..2a4299a 100644
--- 
a/sshd-mina/src/main/java/org/apache/sshd/common/io/mina/MinaServiceFactory.java
+++ 
b/sshd-mina/src/main/java/org/apache/sshd/common/io/mina/MinaServiceFactory.java
@@ -27,7 +27,7 @@ import org.apache.sshd.common.io.AbstractIoServiceFactory;
 import org.apache.sshd.common.io.IoAcceptor;
 import org.apache.sshd.common.io.IoConnector;
 import org.apache.sshd.common.io.IoHandler;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 
 /**
@@ -39,7 +39,7 @@ public class MinaServiceFactory extends 
AbstractIoServiceFactory {
 
     private final IoProcessor<NioSession> ioProcessor;
 
-    public MinaServiceFactory(FactoryManager factoryManager, ExecutorService 
service) {
+    public MinaServiceFactory(FactoryManager factoryManager, 
CloseableExecutorService service) {
         super(factoryManager, ThreadUtils.newCachedThreadPoolIf(service, 
factoryManager.toString() + "-mina"));
         ioProcessor = new SimpleIoProcessorPool<>(NioProcessor.class, 
getExecutorService(), getNioWorkers(factoryManager), null);
     }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-mina/src/main/java/org/apache/sshd/common/io/mina/MinaServiceFactoryFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-mina/src/main/java/org/apache/sshd/common/io/mina/MinaServiceFactoryFactory.java
 
b/sshd-mina/src/main/java/org/apache/sshd/common/io/mina/MinaServiceFactoryFactory.java
index dfef37d..901bf3e 100644
--- 
a/sshd-mina/src/main/java/org/apache/sshd/common/io/mina/MinaServiceFactoryFactory.java
+++ 
b/sshd-mina/src/main/java/org/apache/sshd/common/io/mina/MinaServiceFactoryFactory.java
@@ -22,7 +22,7 @@ import org.apache.sshd.common.Factory;
 import org.apache.sshd.common.FactoryManager;
 import org.apache.sshd.common.io.AbstractIoServiceFactoryFactory;
 import org.apache.sshd.common.io.IoServiceFactory;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 
 /**
  */
@@ -32,10 +32,10 @@ public class MinaServiceFactoryFactory extends 
AbstractIoServiceFactoryFactory {
     }
 
     /**
-     * @param factory      The {@link ExecutorService} factory to use for 
spawning threads.
+     * @param factory      The {@link CloseableExecutorService} factory to use 
for spawning threads.
      *                     If {@code null} then an internal service is 
allocated.
      */
-    public MinaServiceFactoryFactory(Factory<ExecutorService> factory) {
+    public MinaServiceFactoryFactory(Factory<CloseableExecutorService> 
factory) {
         super(factory);
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-scp/src/main/java/org/apache/sshd/server/scp/ScpCommand.java
----------------------------------------------------------------------
diff --git a/sshd-scp/src/main/java/org/apache/sshd/server/scp/ScpCommand.java 
b/sshd-scp/src/main/java/org/apache/sshd/server/scp/ScpCommand.java
index 7af2b09..eee542f 100644
--- a/sshd-scp/src/main/java/org/apache/sshd/server/scp/ScpCommand.java
+++ b/sshd-scp/src/main/java/org/apache/sshd/server/scp/ScpCommand.java
@@ -27,7 +27,7 @@ import org.apache.sshd.common.scp.ScpHelper;
 import org.apache.sshd.common.scp.ScpTransferEventListener;
 import org.apache.sshd.common.scp.helpers.DefaultScpFileOpener;
 import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.sshd.server.Environment;
 import org.apache.sshd.server.command.AbstractFileSystemCommand;
@@ -57,7 +57,7 @@ public class ScpCommand
 
     /**
      * @param command         The command to be executed
-     * @param executorService An {@link ExecutorService} to be used when
+     * @param executorService An {@link CloseableExecutorService} to be used 
when
      *                        {@link #start(Environment)}-ing execution. If 
{@code null} an ad-hoc
      *                        single-threaded service is created and used.
      * @param sendSize        Size (in bytes) of buffer to use when sending 
files
@@ -69,7 +69,7 @@ public class ScpCommand
      * @see ScpHelper#MIN_RECEIVE_BUFFER_SIZE
      */
     public ScpCommand(String command,
-            ExecutorService executorService,
+            CloseableExecutorService executorService,
             int sendSize, int receiveSize,
             ScpFileOpener fileOpener, ScpTransferEventListener eventListener) {
         super(command, executorService);

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-scp/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-scp/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java 
b/sshd-scp/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java
index 4f7aa00..6f7503b 100644
--- a/sshd-scp/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java
+++ b/sshd-scp/src/main/java/org/apache/sshd/server/scp/ScpCommandFactory.java
@@ -28,7 +28,7 @@ import org.apache.sshd.common.scp.ScpTransferEventListener;
 import org.apache.sshd.common.util.EventListenerUtils;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ObjectBuilder;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
 import org.apache.sshd.server.command.AbstractDelegatingCommandFactory;
 import org.apache.sshd.server.command.Command;
@@ -70,7 +70,7 @@ public class ScpCommandFactory
             return this;
         }
 
-        public Builder withExecutorService(ExecutorService service) {
+        public Builder withExecutorService(CloseableExecutorService service) {
             factory.setExecutorService(service);
             return this;
         }
@@ -101,7 +101,7 @@ public class ScpCommandFactory
         }
     }
 
-    private ExecutorService executors;
+    private CloseableExecutorService executors;
     private ScpFileOpener fileOpener;
     private int sendBufferSize = ScpHelper.MIN_SEND_BUFFER_SIZE;
     private int receiveBufferSize = ScpHelper.MIN_RECEIVE_BUFFER_SIZE;
@@ -124,18 +124,18 @@ public class ScpCommandFactory
     }
 
     @Override
-    public ExecutorService getExecutorService() {
+    public CloseableExecutorService getExecutorService() {
         return executors;
     }
 
     /**
-     * @param service An {@link ExecutorService} to be used when
+     * @param service An {@link CloseableExecutorService} to be used when
      * starting {@link ScpCommand} execution. If {@code null} then a 
single-threaded
      * ad-hoc service is used. <B>Note:</B> the service will <U>not</U> be 
shutdown
      * when the command is terminated - unless it is the ad-hoc service, which 
will be
      * shutdown regardless
      */
-    public void setExecutorService(ExecutorService service) {
+    public void setExecutorService(CloseableExecutorService service) {
         executors = service;
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-scp/src/test/java/org/apache/sshd/client/scp/ScpTest.java
----------------------------------------------------------------------
diff --git a/sshd-scp/src/test/java/org/apache/sshd/client/scp/ScpTest.java 
b/sshd-scp/src/test/java/org/apache/sshd/client/scp/ScpTest.java
index 5712e2f..c17ae78 100644
--- a/sshd-scp/src/test/java/org/apache/sshd/client/scp/ScpTest.java
+++ b/sshd-scp/src/test/java/org/apache/sshd/client/scp/ScpTest.java
@@ -59,7 +59,7 @@ import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.OsUtils;
 import org.apache.sshd.common.util.ValidateUtils;
 import org.apache.sshd.common.util.io.IoUtils;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.server.SshServer;
 import org.apache.sshd.server.command.Command;
 import org.apache.sshd.server.scp.ScpCommand;
@@ -768,7 +768,7 @@ public class ScpTest extends BaseTestSupport {
         final int testExitValue = 7365;
         class InternalScpCommand extends ScpCommand {
 
-            InternalScpCommand(String command, ExecutorService executorService,
+            InternalScpCommand(String command, CloseableExecutorService 
executorService,
                     int sendSize, int receiveSize, ScpFileOpener opener, 
ScpTransferEventListener eventListener) {
                 super(command, executorService, sendSize, receiveSize, opener, 
eventListener);
             }

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-scp/src/test/java/org/apache/sshd/server/scp/ScpCommandFactoryTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-scp/src/test/java/org/apache/sshd/server/scp/ScpCommandFactoryTest.java 
b/sshd-scp/src/test/java/org/apache/sshd/server/scp/ScpCommandFactoryTest.java
index 06ae97e..ff2c130 100644
--- 
a/sshd-scp/src/test/java/org/apache/sshd/server/scp/ScpCommandFactoryTest.java
+++ 
b/sshd-scp/src/test/java/org/apache/sshd/server/scp/ScpCommandFactoryTest.java
@@ -20,7 +20,7 @@
 package org.apache.sshd.server.scp;
 
 import org.apache.sshd.common.scp.ScpHelper;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.server.command.CommandFactory;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.apache.sshd.util.test.NoIoTestCase;
@@ -59,7 +59,7 @@ public class ScpCommandFactoryTest extends BaseTestSupport {
     @Test
     public void testBuilderCorrectlyInitializesFactory() {
         CommandFactory delegate = dummyFactory();
-        ExecutorService service = dummyExecutor();
+        CloseableExecutorService service = dummyExecutor();
         int receiveSize = Short.MAX_VALUE;
         int sendSize = receiveSize + Long.SIZE;
         ScpCommandFactory factory = new ScpCommandFactory.Builder()
@@ -99,8 +99,8 @@ public class ScpCommandFactoryTest extends BaseTestSupport {
         assertNotSame("Delegate not changed", f1.getDelegateCommandFactory(), 
f3.getDelegateCommandFactory());
     }
 
-    private static ExecutorService dummyExecutor() {
-        return Mockito.mock(ExecutorService.class);
+    private static CloseableExecutorService dummyExecutor() {
+        return Mockito.mock(CloseableExecutorService.class);
     }
 
     private static CommandFactory dummyFactory() {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
----------------------------------------------------------------------
diff --git 
a/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
 
b/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
index aecbe2f..73955b8 100644
--- 
a/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
+++ 
b/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java
@@ -65,7 +65,7 @@ import org.apache.sshd.common.util.buffer.Buffer;
 import org.apache.sshd.common.util.buffer.BufferUtils;
 import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
 import org.apache.sshd.common.util.io.IoUtils;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.common.util.threads.ExecutorServiceCarrier;
 import org.apache.sshd.common.util.threads.ThreadUtils;
 import org.apache.sshd.server.ChannelSessionAware;
@@ -149,10 +149,10 @@ public class SftpSubsystem
 
     protected ServerSession serverSession;
     protected ChannelSession channelSession;
-    protected ExecutorService executorService;
+    protected CloseableExecutorService executorService;
 
     /**
-     * @param executorService The {@link ExecutorService} to be used by
+     * @param executorService The {@link CloseableExecutorService} to be used 
by
      *                        the {@link SftpSubsystem} command when starting 
execution. If
      *                        {@code null} then a single-threaded ad-hoc 
service is used.
      * @param policy          The {@link UnsupportedAttributePolicy} to use if 
failed to access
@@ -162,8 +162,8 @@ public class SftpSubsystem
      * use when generating failed commands error messages
      * @see ThreadUtils#newSingleThreadExecutor(String)
      */
-    public SftpSubsystem(ExecutorService executorService, 
UnsupportedAttributePolicy policy,
-            SftpFileSystemAccessor accessor, SftpErrorStatusDataHandler 
errorStatusDataHandler) {
+    public SftpSubsystem(CloseableExecutorService executorService, 
UnsupportedAttributePolicy policy,
+                         SftpFileSystemAccessor accessor, 
SftpErrorStatusDataHandler errorStatusDataHandler) {
         super(policy, accessor, errorStatusDataHandler);
 
         if (executorService == null) {
@@ -184,7 +184,7 @@ public class SftpSubsystem
     }
 
     @Override
-    public ExecutorService getExecutorService() {
+    public CloseableExecutorService getExecutorService() {
         return executorService;
     }
 
@@ -267,7 +267,7 @@ public class SftpSubsystem
     public void start(Environment env) throws IOException {
         this.env = env;
         try {
-            ExecutorService executor = getExecutorService();
+            CloseableExecutorService executor = getExecutorService();
             pendingFuture = executor.submit(this);
         } catch (RuntimeException e) {    // e.g., RejectedExecutionException
             log.error("Failed (" + e.getClass().getSimpleName() + ") to start 
command: " + e.toString(), e);
@@ -991,7 +991,7 @@ public class SftpSubsystem
 
         pendingFuture = null;
 
-        ExecutorService executors = getExecutorService();
+        CloseableExecutorService executors = getExecutorService();
         if ((executors != null) && (!executors.isShutdown())) {
             Collection<Runnable> runners = executors.shutdownNow();
             if (debugEnabled) {

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactory.java
----------------------------------------------------------------------
diff --git 
a/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactory.java
 
b/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactory.java
index a60cab6..056b5fa 100644
--- 
a/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactory.java
+++ 
b/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactory.java
@@ -24,7 +24,7 @@ import java.util.Objects;
 import org.apache.sshd.common.subsystem.sftp.SftpConstants;
 import org.apache.sshd.common.util.GenericUtils;
 import org.apache.sshd.common.util.ObjectBuilder;
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.server.command.Command;
 import org.apache.sshd.server.subsystem.SubsystemFactory;
 
@@ -39,7 +39,7 @@ public class SftpSubsystemFactory
     public static final UnsupportedAttributePolicy DEFAULT_POLICY = 
UnsupportedAttributePolicy.Warn;
 
     public static class Builder extends AbstractSftpEventListenerManager 
implements ObjectBuilder<SftpSubsystemFactory> {
-        private ExecutorService executors;
+        private CloseableExecutorService executors;
         private UnsupportedAttributePolicy policy = DEFAULT_POLICY;
         private SftpFileSystemAccessor fileSystemAccessor = 
SftpFileSystemAccessor.DEFAULT;
         private SftpErrorStatusDataHandler errorStatusDataHandler = 
SftpErrorStatusDataHandler.DEFAULT;
@@ -48,7 +48,7 @@ public class SftpSubsystemFactory
             super();
         }
 
-        public Builder withExecutorService(ExecutorService service) {
+        public Builder withExecutorService(CloseableExecutorService service) {
             executors = service;
             return this;
         }
@@ -80,7 +80,7 @@ public class SftpSubsystemFactory
         }
     }
 
-    private ExecutorService executors;
+    private CloseableExecutorService executors;
     private UnsupportedAttributePolicy policy = DEFAULT_POLICY;
     private SftpFileSystemAccessor fileSystemAccessor = 
SftpFileSystemAccessor.DEFAULT;
     private SftpErrorStatusDataHandler errorStatusDataHandler = 
SftpErrorStatusDataHandler.DEFAULT;
@@ -94,15 +94,15 @@ public class SftpSubsystemFactory
         return NAME;
     }
 
-    public ExecutorService getExecutorService() {
+    public CloseableExecutorService getExecutorService() {
         return executors;
     }
 
     /**
-     * @param service The {@link ExecutorService} to be used by the {@link 
SftpSubsystem}
+     * @param service The {@link CloseableExecutorService} to be used by the 
{@link SftpSubsystem}
      * command when starting execution. If {@code null} then a single-threaded 
ad-hoc service is used.
      */
-    public void setExecutorService(ExecutorService service) {
+    public void setExecutorService(CloseableExecutorService service) {
         executors = service;
     }
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce29eab3/sshd-sftp/src/test/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactoryTest.java
----------------------------------------------------------------------
diff --git 
a/sshd-sftp/src/test/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactoryTest.java
 
b/sshd-sftp/src/test/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactoryTest.java
index 436ae17..436c84b 100644
--- 
a/sshd-sftp/src/test/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactoryTest.java
+++ 
b/sshd-sftp/src/test/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystemFactoryTest.java
@@ -19,7 +19,7 @@
 
 package org.apache.sshd.server.subsystem.sftp;
 
-import org.apache.sshd.common.util.threads.ExecutorService;
+import org.apache.sshd.common.util.threads.CloseableExecutorService;
 import org.apache.sshd.util.test.BaseTestSupport;
 import org.apache.sshd.util.test.NoIoTestCase;
 import org.junit.FixMethodOrder;
@@ -55,7 +55,7 @@ public class SftpSubsystemFactoryTest extends BaseTestSupport 
{
     @Test
     public void testBuilderCorrectlyInitializesFactory() {
         SftpSubsystemFactory.Builder builder = new 
SftpSubsystemFactory.Builder();
-        ExecutorService service = dummyExecutor();
+        CloseableExecutorService service = dummyExecutor();
         SftpSubsystemFactory factory = builder.withExecutorService(service)
                 .build();
         assertSame("Mismatched executor", service, 
factory.getExecutorService());
@@ -91,7 +91,7 @@ public class SftpSubsystemFactoryTest extends BaseTestSupport 
{
         assertNotSame("Executor service not changed", f1.getExecutorService(), 
f3.getExecutorService());
     }
 
-    private static ExecutorService dummyExecutor() {
-        return Mockito.mock(ExecutorService.class);
+    private static CloseableExecutorService dummyExecutor() {
+        return Mockito.mock(CloseableExecutorService.class);
     }
 }

Reply via email to