Fixes #1928 - Backport #1705 to jetty-9.3.x.

This commit is contained in:
Simone Bordet 2017-10-30 12:56:34 +01:00
parent 090ce919dd
commit 6f8baff07d
1 changed files with 28 additions and 12 deletions

View File

@ -431,18 +431,7 @@ public class ManagedSelector extends AbstractLifeCycle implements Runnable, Dump
public void destroyEndPoint(final EndPoint endPoint)
{
final Connection connection = endPoint.getConnection();
submit(new Product()
{
@Override
public void run()
{
if (LOG.isDebugEnabled())
LOG.debug("Destroyed {}", endPoint);
if (connection != null)
_selectorManager.connectionClosed(connection);
_selectorManager.endPointClosed(endPoint);
}
});
submit(new DestroyEndPoint(endPoint));
}
@Override
@ -776,4 +765,31 @@ public class ManagedSelector extends AbstractLifeCycle implements Runnable, Dump
}
}
}
private class DestroyEndPoint implements Product, Closeable
{
private final EndPoint _endPoint;
private DestroyEndPoint(EndPoint endPoint)
{
_endPoint = endPoint;
}
@Override
public void run()
{
if (LOG.isDebugEnabled())
LOG.debug("Destroyed {}", _endPoint);
Connection connection = _endPoint.getConnection();
if (connection != null)
_selectorManager.connectionClosed(connection);
_selectorManager.endPointClosed(_endPoint);
}
@Override
public void close() throws IOException
{
run();
}
}
}