Issue #2828 - AbstractHTTP2ServerConnectionFactory concurrent connect low performance.
Fixed test failure. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
9a06acc846
commit
0f6ae93ff8
|
@ -27,6 +27,7 @@ import java.util.ArrayDeque;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
@ -698,7 +699,10 @@ public class StreamResetTest extends AbstractTest
|
|||
// Give time to the server to process the reset and drain the flusher queue.
|
||||
Thread.sleep(500);
|
||||
|
||||
HTTP2Session session = connector.getConnectionFactory(AbstractHTTP2ServerConnectionFactory.class).getBean(HTTP2Session.class);
|
||||
AbstractHTTP2ServerConnectionFactory http2 = connector.getConnectionFactory(AbstractHTTP2ServerConnectionFactory.class);
|
||||
Set<Session> sessions = http2.getBean(AbstractHTTP2ServerConnectionFactory.HTTP2SessionContainer.class).getSessions();
|
||||
Assert.assertEquals(1, sessions.size());
|
||||
HTTP2Session session = (HTTP2Session)sessions.iterator().next();
|
||||
HTTP2Flusher flusher = session.getBean(HTTP2Flusher.class);
|
||||
Assert.assertEquals(0, flusher.getFrameQueueSize());
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.eclipse.jetty.http2.server;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
@ -273,6 +274,11 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
|
|||
LifeCycle.stop(session);
|
||||
}
|
||||
|
||||
public Set<Session> getSessions()
|
||||
{
|
||||
return new HashSet<>(sessions);
|
||||
}
|
||||
|
||||
@ManagedAttribute(value = "The number of HTTP/2 sessions", readonly = true)
|
||||
public int getSize()
|
||||
{
|
||||
|
@ -295,7 +301,7 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%s@%x[size=%d]", getClass().getSimpleName(), hashCode(), sessions.size());
|
||||
return String.format("%s@%x[size=%d]", getClass().getSimpleName(), hashCode(), getSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue