diff options
author | Thomas Becker | 2013-06-21 12:44:58 +0000 |
---|---|---|
committer | Thomas Becker | 2013-06-21 12:45:16 +0000 |
commit | 918632d40851ca939ba0ec502e2cd95a54f1dd1e (patch) | |
tree | f6b91863795f87b837538d376aa80b455297d06f /jetty-spdy/spdy-client/src | |
parent | b119bdfa247beb0dcc45cbd2867a6985dfeada9c (diff) | |
download | org.eclipse.jetty.project-918632d40851ca939ba0ec502e2cd95a54f1dd1e.tar.gz org.eclipse.jetty.project-918632d40851ca939ba0ec502e2cd95a54f1dd1e.tar.xz org.eclipse.jetty.project-918632d40851ca939ba0ec502e2cd95a54f1dd1e.zip |
411340 SpdyConnection make executeOnFillable configurable and default to true
Diffstat (limited to 'jetty-spdy/spdy-client/src')
3 files changed, 21 insertions, 8 deletions
diff --git a/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClient.java b/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClient.java index e2a0cba22a..c4360a2c12 100644 --- a/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClient.java +++ b/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClient.java @@ -60,6 +60,7 @@ public class SPDYClient private volatile SocketAddress bindAddress; private volatile long idleTimeout = -1; private volatile int initialWindowSize; + private volatile boolean executeOnFillable; protected SPDYClient(short version, Factory factory) { @@ -125,6 +126,16 @@ public class SPDYClient this.initialWindowSize = initialWindowSize; } + public boolean isExecuteOnFillable() + { + return executeOnFillable; + } + + public void setExecuteOnFillable(boolean executeOnFillable) + { + this.executeOnFillable = executeOnFillable; + } + protected String selectProtocol(List<String> serverProtocols) { String protocol = "spdy/" + version; diff --git a/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClientConnectionFactory.java b/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClientConnectionFactory.java index 536f88ce3f..18244e87a8 100644 --- a/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClientConnectionFactory.java +++ b/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYClientConnectionFactory.java @@ -45,7 +45,7 @@ public class SPDYClientConnectionFactory Parser parser = new Parser(compressionFactory.newDecompressor()); Generator generator = new Generator(bufferPool, compressionFactory.newCompressor()); - SPDYConnection connection = new ClientSPDYConnection(endPoint, bufferPool, parser, factory); + SPDYConnection connection = new ClientSPDYConnection(endPoint, bufferPool, parser, factory, client.isExecuteOnFillable()); FlowControlStrategy flowControlStrategy = client.newFlowControlStrategy(); @@ -66,9 +66,10 @@ public class SPDYClientConnectionFactory { private final Factory factory; - public ClientSPDYConnection(EndPoint endPoint, ByteBufferPool bufferPool, Parser parser, Factory factory) + public ClientSPDYConnection(EndPoint endPoint, ByteBufferPool bufferPool, Parser parser, Factory factory, + boolean executeOnFillable) { - super(endPoint, bufferPool, parser, factory.getExecutor()); + super(endPoint, bufferPool, parser, factory.getExecutor(), executeOnFillable); this.factory = factory; } diff --git a/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYConnection.java b/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYConnection.java index 33ed4c66c4..b057b8a923 100644 --- a/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYConnection.java +++ b/jetty-spdy/spdy-client/src/main/java/org/eclipse/jetty/spdy/client/SPDYConnection.java @@ -44,20 +44,21 @@ public class SPDYConnection extends AbstractConnection implements Controller, Id private volatile ISession session; private volatile boolean idle = false; - - public SPDYConnection(EndPoint endPoint, ByteBufferPool bufferPool, Parser parser, Executor executor) + public SPDYConnection(EndPoint endPoint, ByteBufferPool bufferPool, Parser parser, Executor executor, + boolean executeOnFillable) { - this(endPoint, bufferPool, parser, executor, 8192); + this(endPoint, bufferPool, parser, executor, executeOnFillable, 8192); } - public SPDYConnection(EndPoint endPoint, ByteBufferPool bufferPool, Parser parser, Executor executor, int bufferSize) + public SPDYConnection(EndPoint endPoint, ByteBufferPool bufferPool, Parser parser, Executor executor, + boolean executeOnFillable, int bufferSize) { // Since SPDY is multiplexed, onFillable() must never block // while calling application code. In fact, onFillable() // always dispatches to a new thread when calling application // code, so here we can safely pass false as last parameter, // and avoid to dispatch to onFillable(). - super(endPoint, executor, !EXECUTE_ONFILLABLE); + super(endPoint, executor, executeOnFillable); this.bufferPool = bufferPool; this.parser = parser; onIdle(true); |