Motivation:

The HTTP/2 tests have been unstable, in particular the
Http2ConnectionRoundtripTest.

Modifications:

Modified fields in Http2TestUtil to be volatile.

Result:

Tests should (hopefully) be more stable.
This commit is contained in:
nmittler 2014-10-01 08:41:18 -07:00
parent 4587bbf9f5
commit 6f55a5b8e8
6 changed files with 11 additions and 11 deletions

View File

@ -82,8 +82,8 @@ public class DataCompressionHttp2Test {
private Channel serverChannel; private Channel serverChannel;
private Channel serverConnectedChannel; private Channel serverConnectedChannel;
private Channel clientChannel; private Channel clientChannel;
private CountDownLatch serverLatch; private volatile CountDownLatch serverLatch;
private CountDownLatch clientLatch; private volatile CountDownLatch clientLatch;
private Http2TestUtil.FrameAdapter serverAdapter; private Http2TestUtil.FrameAdapter serverAdapter;
private Http2TestUtil.FrameAdapter clientAdapter; private Http2TestUtil.FrameAdapter clientAdapter;
private Http2Connection serverConnection; private Http2Connection serverConnection;

View File

@ -82,7 +82,7 @@ public class DefaultHttp2ToHttpConnectionHandlerTest {
private Bootstrap cb; private Bootstrap cb;
private Channel serverChannel; private Channel serverChannel;
private Channel clientChannel; private Channel clientChannel;
private CountDownLatch requestLatch; private volatile CountDownLatch requestLatch;
private Http2TestUtil.FrameCountDown serverFrameCountDown; private Http2TestUtil.FrameCountDown serverFrameCountDown;
@Before @Before

View File

@ -87,8 +87,8 @@ public class Http2ConnectionRoundtripTest {
private Channel serverChannel; private Channel serverChannel;
private Channel clientChannel; private Channel clientChannel;
private Http2TestUtil.FrameCountDown serverFrameCountDown; private Http2TestUtil.FrameCountDown serverFrameCountDown;
private CountDownLatch requestLatch; private volatile CountDownLatch requestLatch;
private CountDownLatch dataLatch; private volatile CountDownLatch dataLatch;
@Before @Before
public void setup() throws Exception { public void setup() throws Exception {

View File

@ -73,7 +73,7 @@ public class Http2FrameRoundtripTest {
private Bootstrap cb; private Bootstrap cb;
private Channel serverChannel; private Channel serverChannel;
private Channel clientChannel; private Channel clientChannel;
private CountDownLatch requestLatch; private volatile CountDownLatch requestLatch;
private Http2TestUtil.FrameAdapter serverAdapter; private Http2TestUtil.FrameAdapter serverAdapter;
@Before @Before

View File

@ -88,7 +88,7 @@ final class Http2TestUtil {
private final Http2Connection connection; private final Http2Connection connection;
private final Http2FrameListener listener; private final Http2FrameListener listener;
private final DefaultHttp2FrameReader reader; private final DefaultHttp2FrameReader reader;
private CountDownLatch latch; private volatile CountDownLatch latch;
FrameAdapter(Http2FrameListener listener, CountDownLatch latch) { FrameAdapter(Http2FrameListener listener, CountDownLatch latch) {
this(null, listener, latch); this(null, listener, latch);
@ -264,8 +264,8 @@ final class Http2TestUtil {
*/ */
static class FrameCountDown implements Http2FrameListener { static class FrameCountDown implements Http2FrameListener {
private final Http2FrameListener listener; private final Http2FrameListener listener;
private CountDownLatch messageLatch; private volatile CountDownLatch messageLatch;
private CountDownLatch dataLatch; private volatile CountDownLatch dataLatch;
public FrameCountDown(Http2FrameListener listener, CountDownLatch messageLatch) { public FrameCountDown(Http2FrameListener listener, CountDownLatch messageLatch) {
this(listener, messageLatch, null); this(listener, messageLatch, null);

View File

@ -81,8 +81,8 @@ public class InboundHttp2ToHttpAdapterTest {
private Channel serverChannel; private Channel serverChannel;
private Channel serverConnectedChannel; private Channel serverConnectedChannel;
private Channel clientChannel; private Channel clientChannel;
private CountDownLatch serverLatch; private volatile CountDownLatch serverLatch;
private CountDownLatch clientLatch; private volatile CountDownLatch clientLatch;
private int maxContentLength; private int maxContentLength;
private HttpResponseDelegator serverDelegator; private HttpResponseDelegator serverDelegator;
private HttpResponseDelegator clientDelegator; private HttpResponseDelegator clientDelegator;