Author: norman
Date: Thu Nov 24 11:06:17 2011
New Revision: 1205788
URL: http://svn.apache.org/viewvc?rev=1205788&view=rev
Log:
Make sure all registered listeners get executed even if an unchecked exception
was thrown. See PROTOCOLS-52
Modified:
james/protocols/trunk/api/src/main/java/org/apache/james/protocols/api/FutureResponseImpl.java
Modified:
james/protocols/trunk/api/src/main/java/org/apache/james/protocols/api/FutureResponseImpl.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/api/src/main/java/org/apache/james/protocols/api/FutureResponseImpl.java?rev=1205788&r1=1205787&r2=1205788&view=diff
==============================================================================
---
james/protocols/trunk/api/src/main/java/org/apache/james/protocols/api/FutureResponseImpl.java
(original)
+++
james/protocols/trunk/api/src/main/java/org/apache/james/protocols/api/FutureResponseImpl.java
Thu Nov 24 11:06:17 2011
@@ -22,6 +22,9 @@ package org.apache.james.protocols.api;
import java.util.ArrayList;
import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* {@link FutureResponse} implementation which wraps a {@link
AbstractResponse} implementation
*
@@ -29,6 +32,8 @@ import java.util.List;
*/
public class FutureResponseImpl implements FutureResponse{
+ private final static Logger LOGGER =
LoggerFactory.getLogger(FutureResponseImpl.class);
+
protected Response response;
private List<ResponseListener> listeners;
private int waiters;
@@ -103,7 +108,11 @@ public class FutureResponseImpl implemen
notifyAll();
}
for (ResponseListener listener: listeners) {
- listener.onResponse(this);
+ try {
+ listener.onResponse(this);
+ } catch (Throwable e) {
+ LOGGER.warn("An exception was thrown by the listener " +
listener, e);
+ }
}
listeners = null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]