only release connection when channel got released to avoid double connection release race condition
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
parent
92f6eabb26
commit
0b97b8415b
|
@ -106,7 +106,7 @@ public class HttpChannelOverHTTP2 extends HttpChannel
|
|||
public void release()
|
||||
{
|
||||
setStream(null);
|
||||
connection.release(this);
|
||||
if (connection.release(this))
|
||||
getHttpDestination().release(getHttpConnection());
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ public class HttpConnectionOverHTTP2 extends HttpConnection implements Sweeper.S
|
|||
return new HttpChannelOverHTTP2(getHttpDestination(), this, getSession());
|
||||
}
|
||||
|
||||
protected void release(HttpChannelOverHTTP2 channel)
|
||||
protected boolean release(HttpChannelOverHTTP2 channel)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Released {}", channel);
|
||||
|
@ -162,10 +162,12 @@ public class HttpConnectionOverHTTP2 extends HttpConnection implements Sweeper.S
|
|||
channel.destroy();
|
||||
else if (isRecycleHttpChannels())
|
||||
idleChannels.offer(channel);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
channel.destroy();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -431,7 +431,13 @@ public class Pool<T> implements AutoCloseable, Dumpable
|
|||
// iterate the copy and close its entries
|
||||
for (Entry entry : copy)
|
||||
{
|
||||
if (entry.tryRemove() && entry.pooled instanceof Closeable)
|
||||
boolean removed = entry.tryRemove();
|
||||
if (!removed)
|
||||
{
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Pooled object still in use: {}", entry);
|
||||
}
|
||||
if (removed && entry.pooled instanceof Closeable)
|
||||
IO.close((Closeable)entry.pooled);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue