From 30adf7cd18d3611cace9a5a2da63d979847caa2d Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 2 Apr 2012 13:22:06 +0200 Subject: [PATCH] Added missing flush after writing frames. Frames may be written asynchronously but without a Handler, and therefore it was possible that frames queued up, that one flush() was writing a frame without Handler, and the flush was stopping even if the queue was non-empty. Now we call flush() after writing a frame. --- .../eclipse/jetty/spdy/StandardSession.java | 1 + .../jetty/spdy/SynDataReplyDataLoadTest.java | 54 +++++++++++-------- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java b/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java index 42f5ba0ef44..ecf5deb1fed 100644 --- a/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java +++ b/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java @@ -854,6 +854,7 @@ public class StandardSession implements ISession, Parser.Listener, Handler> tasks = new ArrayList<>(); - for (int i = 0; i < count; ++i) - { - tasks.add(new Callable() - { - @Override - public Object call() throws Exception - { - synCompletedData(session, headers, iterations); - return null; - } - }); - } - ExecutorService threadPool = Executors.newFixedThreadPool(count); - List> futures = threadPool.invokeAll(tasks); - for (Future future : futures) - future.get(iterations, TimeUnit.SECONDS); - Assert.assertTrue(latch.await(count * iterations, TimeUnit.SECONDS)); + List> tasks = new ArrayList<>(); tasks.clear(); for (int i = 0; i < count; ++i) @@ -120,11 +103,38 @@ public class SynDataReplyDataLoadTest extends AbstractTest } }); } + { + long begin = System.nanoTime(); + List> futures = threadPool.invokeAll(tasks); + for (Future future : futures) + future.get(iterations, TimeUnit.SECONDS); + Assert.assertTrue(latch.await(count * iterations, TimeUnit.SECONDS)); + long end = System.nanoTime(); + System.err.printf("SYN+GET+DATA+GET completed in %d ms%n", TimeUnit.NANOSECONDS.toMillis(end - begin)); + } - futures = threadPool.invokeAll(tasks); - for (Future future : futures) - future.get(iterations, TimeUnit.SECONDS); - Assert.assertTrue(latch.await(count * iterations, TimeUnit.SECONDS)); + tasks.clear(); + for (int i = 0; i < count; ++i) + { + tasks.add(new Callable() + { + @Override + public Object call() throws Exception + { + synCompletedData(session, headers, iterations); + return null; + } + }); + } + { + long begin = System.nanoTime(); + List> futures = threadPool.invokeAll(tasks); + for (Future future : futures) + future.get(iterations, TimeUnit.SECONDS); + Assert.assertTrue(latch.await(count * iterations, TimeUnit.SECONDS)); + long end = System.nanoTime(); + System.err.printf("SYN+COMPLETED+DATA completed in %d ms%n", TimeUnit.NANOSECONDS.toMillis(end - begin)); + } threadPool.shutdown(); }