You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2014/09/10 11:35:37 UTC
[1/2] git commit: Added a printstacktrace when we get a
ClosedSelectorException (DIRMINA-978)
Repository: mina
Updated Branches:
refs/heads/2.0 ba995db5e -> 2cb34e538
Added a printstacktrace when we get a ClosedSelectorException
(DIRMINA-978)
Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/64c80b90
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/64c80b90
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/64c80b90
Branch: refs/heads/2.0
Commit: 64c80b9044fe1ec1c976d8022411d25f923aebd2
Parents: ba995db
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Wed Sep 10 11:27:02 2014 +0200
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Wed Sep 10 11:27:02 2014 +0200
----------------------------------------------------------------------
.../core/polling/AbstractPollingIoAcceptor.java | 5 +--
.../polling/AbstractPollingIoConnector.java | 33 ++++++++++----------
.../polling/AbstractPollingIoProcessor.java | 2 ++
.../socket/nio/NioDatagramAcceptor.java | 1 +
4 files changed, 23 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina/blob/64c80b90/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java
index 5a4275c..420f62c 100644
--- a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java
+++ b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java
@@ -149,7 +149,7 @@ public abstract class AbstractPollingIoAcceptor<S extends AbstractIoSession, H>
* @param selectorProvider The SelectorProvider to use
*/
protected AbstractPollingIoAcceptor(IoSessionConfig sessionConfig, Class<? extends IoProcessor<S>> processorClass,
- int processorCount, SelectorProvider selectorProvider ) {
+ int processorCount, SelectorProvider selectorProvider ) {
this(sessionConfig, null, new SimpleIoProcessorPool<S>(processorClass, processorCount, selectorProvider), true, selectorProvider);
}
@@ -478,6 +478,7 @@ public abstract class AbstractPollingIoAcceptor<S extends AbstractIoSession, H>
nHandles -= unregisterHandles();
} catch (ClosedSelectorException cse) {
// If the selector has been closed, we can exit the loop
+ cse.printStackTrace();
break;
} catch (Throwable e) {
ExceptionMonitor.getInstance().exceptionCaught(e);
@@ -688,7 +689,7 @@ public abstract class AbstractPollingIoAcceptor<S extends AbstractIoSession, H>
this.reuseAddress = reuseAddress;
}
}
-
+
/**
* {@inheritDoc}
*/
http://git-wip-us.apache.org/repos/asf/mina/blob/64c80b90/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoConnector.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoConnector.java b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoConnector.java
index ec377cc..f2be861 100644
--- a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoConnector.java
+++ b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoConnector.java
@@ -123,8 +123,8 @@ public abstract class AbstractPollingIoConnector<T extends AbstractIoSession, H>
*
* @param sessionConfig
* the default configuration for the managed {@link IoSession}
- * @param processor the {@link IoProcessor} for processing the {@link IoSession} of this transport, triggering
- * events to the bound {@link IoHandler} and processing the chains of {@link IoFilter}
+ * @param processor the {@link IoProcessor} for processing the {@link IoSession} of this transport, triggering
+ * events to the bound {@link IoHandler} and processing the chains of {@link IoFilter}
*/
protected AbstractPollingIoConnector(IoSessionConfig sessionConfig, IoProcessor<T> processor) {
this(sessionConfig, null, processor, false);
@@ -143,8 +143,8 @@ public abstract class AbstractPollingIoConnector<T extends AbstractIoSession, H>
* @param executor
* the {@link Executor} used for handling asynchronous execution of I/O
* events. Can be <code>null</code>.
- * @param processor the {@link IoProcessor} for processing the {@link IoSession} of this transport, triggering
- * events to the bound {@link IoHandler} and processing the chains of {@link IoFilter}
+ * @param processor the {@link IoProcessor} for processing the {@link IoSession} of this transport, triggering
+ * events to the bound {@link IoHandler} and processing the chains of {@link IoFilter}
*/
protected AbstractPollingIoConnector(IoSessionConfig sessionConfig, Executor executor, IoProcessor<T> processor) {
this(sessionConfig, executor, processor, false);
@@ -163,9 +163,9 @@ public abstract class AbstractPollingIoConnector<T extends AbstractIoSession, H>
* @param executor
* the {@link Executor} used for handling asynchronous execution of I/O
* events. Can be <code>null</code>.
- * @param processor the {@link IoProcessor} for processing the {@link IoSession} of this transport, triggering
+ * @param processor the {@link IoProcessor} for processing the {@link IoSession} of this transport, triggering
* events to the bound {@link IoHandler} and processing the chains of {@link IoFilter}
- * @param createdProcessor tagging the processor as automatically created, so it will be automatically disposed
+ * @param createdProcessor tagging the processor as automatically created, so it will be automatically disposed
*/
private AbstractPollingIoConnector(IoSessionConfig sessionConfig, Executor executor, IoProcessor<T> processor,
boolean createdProcessor) {
@@ -198,21 +198,21 @@ public abstract class AbstractPollingIoConnector<T extends AbstractIoSession, H>
/**
* Initialize the polling system, will be called at construction time.
- * @throws Exception any exception thrown by the underlying system calls
+ * @throws Exception any exception thrown by the underlying system calls
*/
protected abstract void init() throws Exception;
/**
* Destroy the polling system, will be called when this {@link IoConnector}
- * implementation will be disposed.
+ * implementation will be disposed.
* @throws Exception any exception thrown by the underlying systems calls
*/
protected abstract void destroy() throws Exception;
/**
* Create a new client socket handle from a local {@link SocketAddress}
- * @param localAddress the socket address for binding the new client socket
- * @return a new client socket handle
+ * @param localAddress the socket address for binding the new client socket
+ * @return a new client socket handle
* @throws Exception any exception thrown by the underlying systems calls
*/
protected abstract H newHandle(SocketAddress localAddress) throws Exception;
@@ -223,7 +223,7 @@ public abstract class AbstractPollingIoConnector<T extends AbstractIoSession, H>
* process.
* @param handle the client socket handle
* @param remoteAddress the remote address where to connect
- * @return <tt>true</tt> if a connection was established, <tt>false</tt> if this client socket
+ * @return <tt>true</tt> if a connection was established, <tt>false</tt> if this client socket
* is in non-blocking mode and the connection operation is in progress
* @throws Exception
*/
@@ -264,7 +264,7 @@ public abstract class AbstractPollingIoConnector<T extends AbstractIoSession, H>
/**
* Check for connected sockets, interrupt when at least a connection is processed (connected or
- * failed to connect). All the client socket descriptors processed need to be returned by
+ * failed to connect). All the client socket descriptors processed need to be returned by
* {@link #selectedHandles()}
* @return The number of socket having received some data
* @throws Exception any exception thrown by the underlying systems calls
@@ -272,7 +272,7 @@ public abstract class AbstractPollingIoConnector<T extends AbstractIoSession, H>
protected abstract int select(int timeout) throws Exception;
/**
- * {@link Iterator} for the set of client sockets found connected or
+ * {@link Iterator} for the set of client sockets found connected or
* failed to connect during the last {@link #select()} call.
* @return the list of client socket handles to process
*/
@@ -286,7 +286,7 @@ public abstract class AbstractPollingIoConnector<T extends AbstractIoSession, H>
/**
* Register a new client socket for connection, add it to connection polling
- * @param handle client socket handle
+ * @param handle client socket handle
* @param request the associated {@link ConnectionRequest}
* @throws Exception any exception thrown by the underlying systems calls
*/
@@ -294,7 +294,7 @@ public abstract class AbstractPollingIoConnector<T extends AbstractIoSession, H>
/**
* get the {@link ConnectionRequest} for a given client socket handle
- * @param handle the socket client handle
+ * @param handle the socket client handle
* @return the connection request if the socket is connecting otherwise <code>null</code>
*/
protected abstract ConnectionRequest getConnectionRequest(H handle);
@@ -421,7 +421,7 @@ public abstract class AbstractPollingIoConnector<T extends AbstractIoSession, H>
/**
* Process the incoming connections, creating a new session for each
- * valid connection.
+ * valid connection.
*/
private int processConnections(Iterator<H> handlers) {
int nHandles = 0;
@@ -515,6 +515,7 @@ public abstract class AbstractPollingIoConnector<T extends AbstractIoSession, H>
nHandles -= cancelKeys();
} catch (ClosedSelectorException cse) {
// If the selector has been closed, we can exit the loop
+ cse.printStackTrace();
break;
} catch (Throwable e) {
ExceptionMonitor.getInstance().exceptionCaught(e);
http://git-wip-us.apache.org/repos/asf/mina/blob/64c80b90/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
index 8967951..7561829 100644
--- a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
+++ b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
@@ -1158,6 +1158,8 @@ public abstract class AbstractPollingIoProcessor<S extends AbstractIoSession> im
}
} catch (ClosedSelectorException cse) {
// If the selector has been closed, we can exit the loop
+ // But first, dump a stack trace
+ cse.printStackTrace();
break;
} catch (Throwable t) {
ExceptionMonitor.getInstance().exceptionCaught(t);
http://git-wip-us.apache.org/repos/asf/mina/blob/64c80b90/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
index a128105..1e8cc58 100644
--- a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
+++ b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
@@ -185,6 +185,7 @@ public final class NioDatagramAcceptor extends AbstractIoAcceptor implements Dat
notifyIdleSessions(currentTime);
} catch (ClosedSelectorException cse) {
// If the selector has been closed, we can exit the loop
+ cse.printStackTrace();
break;
} catch (Exception e) {
ExceptionMonitor.getInstance().exceptionCaught(e);
[2/2] git commit: Replaced the printStacktrace by a call to
exceptionCaught()
Posted by el...@apache.org.
Replaced the printStacktrace by a call to exceptionCaught()
Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/2cb34e53
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/2cb34e53
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/2cb34e53
Branch: refs/heads/2.0
Commit: 2cb34e5389c552603d77648cc852692a3c3ed728
Parents: 64c80b9
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Wed Sep 10 11:29:31 2014 +0200
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Wed Sep 10 11:29:31 2014 +0200
----------------------------------------------------------------------
.../org/apache/mina/core/polling/AbstractPollingIoAcceptor.java | 2 +-
.../org/apache/mina/core/polling/AbstractPollingIoConnector.java | 2 +-
.../org/apache/mina/core/polling/AbstractPollingIoProcessor.java | 2 +-
.../org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina/blob/2cb34e53/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java
index 420f62c..cb123c6 100644
--- a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java
+++ b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoAcceptor.java
@@ -478,7 +478,7 @@ public abstract class AbstractPollingIoAcceptor<S extends AbstractIoSession, H>
nHandles -= unregisterHandles();
} catch (ClosedSelectorException cse) {
// If the selector has been closed, we can exit the loop
- cse.printStackTrace();
+ ExceptionMonitor.getInstance().exceptionCaught(cse);
break;
} catch (Throwable e) {
ExceptionMonitor.getInstance().exceptionCaught(e);
http://git-wip-us.apache.org/repos/asf/mina/blob/2cb34e53/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoConnector.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoConnector.java b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoConnector.java
index f2be861..04ff153 100644
--- a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoConnector.java
+++ b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoConnector.java
@@ -515,7 +515,7 @@ public abstract class AbstractPollingIoConnector<T extends AbstractIoSession, H>
nHandles -= cancelKeys();
} catch (ClosedSelectorException cse) {
// If the selector has been closed, we can exit the loop
- cse.printStackTrace();
+ ExceptionMonitor.getInstance().exceptionCaught(cse);
break;
} catch (Throwable e) {
ExceptionMonitor.getInstance().exceptionCaught(e);
http://git-wip-us.apache.org/repos/asf/mina/blob/2cb34e53/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
index 7561829..0819b4a 100644
--- a/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
+++ b/mina-core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
@@ -1159,7 +1159,7 @@ public abstract class AbstractPollingIoProcessor<S extends AbstractIoSession> im
} catch (ClosedSelectorException cse) {
// If the selector has been closed, we can exit the loop
// But first, dump a stack trace
- cse.printStackTrace();
+ ExceptionMonitor.getInstance().exceptionCaught(cse);
break;
} catch (Throwable t) {
ExceptionMonitor.getInstance().exceptionCaught(t);
http://git-wip-us.apache.org/repos/asf/mina/blob/2cb34e53/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
index 1e8cc58..5135897 100644
--- a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
+++ b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
@@ -185,7 +185,7 @@ public final class NioDatagramAcceptor extends AbstractIoAcceptor implements Dat
notifyIdleSessions(currentTime);
} catch (ClosedSelectorException cse) {
// If the selector has been closed, we can exit the loop
- cse.printStackTrace();
+ ExceptionMonitor.getInstance().exceptionCaught(cse);
break;
} catch (Exception e) {
ExceptionMonitor.getInstance().exceptionCaught(e);