Issue #4323 Ensure QoSFilter handles IllegalStateException (#4372)

Signed-off-by: Jan Bartel <janb@webtide.com>
This commit is contained in:
Jan Bartel 2019-12-03 12:16:24 +11:00 committed by GitHub
parent 85cda88b40
commit db9ad2fcec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 5 deletions

View File

@ -216,6 +216,8 @@ public class QoSFilter implements Filter
{
if (accepted)
{
_passes.release();
for (int p = _queues.length - 1; p >= 0; --p)
{
AsyncContext asyncContext = _queues[p].poll();
@ -225,13 +227,20 @@ public class QoSFilter implements Filter
Boolean suspended = (Boolean)candidate.getAttribute(_suspended);
if (Boolean.TRUE.equals(suspended))
{
candidate.setAttribute(_resumed, Boolean.TRUE);
asyncContext.dispatch();
break;
try
{
candidate.setAttribute(_resumed, Boolean.TRUE);
asyncContext.dispatch();
break;
}
catch (IllegalStateException x)
{
LOG.warn(x);
continue;
}
}
}
}
_passes.release();
}
}
}
@ -368,7 +377,8 @@ public class QoSFilter implements Filter
// redispatched again at the end of the filtering.
AsyncContext asyncContext = event.getAsyncContext();
_queues[priority].remove(asyncContext);
asyncContext.dispatch();
((HttpServletResponse)event.getSuppliedResponse()).sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
asyncContext.complete();
}
@Override