You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2014/02/10 16:41:32 UTC
[2/3] git commit: Add a rejected execution handler to the nio2
executor
Add a rejected execution handler to the nio2 executor
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/83fdcd2f
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/83fdcd2f
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/83fdcd2f
Branch: refs/heads/master
Commit: 83fdcd2f573aa827753381ed16016c86a5d11f40
Parents: b732c84
Author: Guillaume Nodet <gn...@apache.org>
Authored: Mon Feb 10 16:41:09 2014 +0100
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Mon Feb 10 16:41:09 2014 +0100
----------------------------------------------------------------------
.../java/org/apache/sshd/common/io/nio2/Nio2ServiceFactory.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/83fdcd2f/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 8867da6..46713e0 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
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.nio.channels.AsynchronousChannelGroup;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.sshd.common.FactoryManager;
@@ -47,6 +48,7 @@ public class Nio2ServiceFactory implements IoServiceFactory {
this.manager = manager;
try {
ExecutorService executor = Executors.newFixedThreadPool(getNioWorkers());
+ ((ThreadPoolExecutor) executor).setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
group = AsynchronousChannelGroup.withThreadPool(executor);
} catch (IOException e) {
throw new RuntimeSshException(e);