Catch unchecked exceptions / errors thrown during produce to avoid letting the stack trace be logged by the execution strategy

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2023-02-01 18:48:41 +01:00
parent 490f86e9a6
commit b1739aca53
1 changed files with 22 additions and 15 deletions

View File

@ -215,25 +215,32 @@ public abstract class ProtocolSession extends ContainerLifeCycle
if (task != null)
return task;
while (true)
try
{
processWritableStreams();
boolean loop = processReadableStreams();
while (true)
{
processWritableStreams();
boolean loop = processReadableStreams();
task = poll();
if (LOG.isDebugEnabled())
LOG.debug("dequeued produced stream task {} on {}", task, ProtocolSession.this);
if (task != null)
return task;
task = poll();
if (LOG.isDebugEnabled())
LOG.debug("dequeued produced stream task {} on {}", task, ProtocolSession.this);
if (task != null)
return task;
if (!loop)
break;
if (!loop)
break;
}
CloseInfo closeInfo = session.getRemoteCloseInfo();
if (closeInfo != null)
onClose(closeInfo.error(), closeInfo.reason());
}
catch (Throwable x)
{
if (LOG.isDebugEnabled())
LOG.debug("Caught error while producing, returning null", x);
}
CloseInfo closeInfo = session.getRemoteCloseInfo();
if (closeInfo != null)
onClose(closeInfo.error(), closeInfo.reason());
return null;
}
}