Skip to content

Commit

Permalink
Fixes #1928 - Backport #1705 to jetty-9.3.x.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbordet committed Oct 30, 2017
1 parent 090ce91 commit 6f8baff
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions jetty-io/src/main/java/org/eclipse/jetty/io/ManagedSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -431,18 +431,7 @@ private EndPoint createEndPoint(SocketChannel channel, SelectionKey selectionKey
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
Expand Down Expand Up @@ -776,4 +765,31 @@ public boolean await(long timeout)
}
}
}

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();
}
}
}

0 comments on commit 6f8baff

Please sign in to comment.