Perform onException delegation outside of connection monitor
Issue: SPR-15738
This commit is contained in:
@@ -706,12 +706,14 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onException(JMSException ex) {
|
public void onException(JMSException ex) {
|
||||||
|
// Iterate over temporary copy in order to avoid ConcurrentModificationException,
|
||||||
|
// since listener invocations may in turn trigger registration of listeners...
|
||||||
|
Set<ExceptionListener> copy;
|
||||||
synchronized (connectionMonitor) {
|
synchronized (connectionMonitor) {
|
||||||
// Iterate over temporary copy in order to avoid ConcurrentModificationException,
|
copy = new LinkedHashSet<>(this.delegates);
|
||||||
// since listener invocations may in turn trigger registration of listeners...
|
}
|
||||||
for (ExceptionListener listener : new LinkedHashSet<>(this.delegates)) {
|
for (ExceptionListener listener : copy) {
|
||||||
listener.onException(ex);
|
listener.onException(ex);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user