Fixes #2847 - Wrap Connection.Listener invocations in try/catch.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2018-08-22 16:11:08 +02:00
parent e93dc59e10
commit 1a7eac5966
1 changed files with 24 additions and 0 deletions

View File

@ -199,7 +199,19 @@ public abstract class AbstractConnection implements Connection
LOG.debug("onOpen {}", this);
for (Listener listener : _listeners)
onOpened(listener);
}
private void onOpened(Listener listener)
{
try
{
listener.onOpened(this);
}
catch (Throwable x)
{
LOG.info("Failure while notifying listener " + listener, x);
}
}
@Override
@ -209,7 +221,19 @@ public abstract class AbstractConnection implements Connection
LOG.debug("onClose {}",this);
for (Listener listener : _listeners)
onClosed(listener);
}
private void onClosed(Listener listener)
{
try
{
listener.onClosed(this);
}
catch (Throwable x)
{
LOG.info("Failure while notifying listener " + listener, x);
}
}
@Override