diff options
Diffstat (limited to 'jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java')
-rw-r--r-- | jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java index 102734bdfe..d12425210d 100644 --- a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java +++ b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java @@ -44,7 +44,6 @@ public class HttpTransportOverHTTP2 implements HttpTransport private static final Logger LOG = Log.getLogger(HttpTransportOverHTTP2.class); private final AtomicBoolean commit = new AtomicBoolean(); - private final Callback commitCallback = new CommitCallback(); private final Connector connector; private final HTTP2ServerConnection connection; private IStream stream; @@ -62,7 +61,7 @@ public class HttpTransportOverHTTP2 implements HttpTransport // copying we can defer to the endpoint return connection.getEndPoint().isOptimizedForDirectBuffers(); } - + public IStream getStream() { return stream; @@ -101,8 +100,24 @@ public class HttpTransportOverHTTP2 implements HttpTransport { if (hasContent) { - commit(info, false, commitCallback); - send(content, lastContent, callback); + commit(info, false, new Callback() + { + @Override + public void succeeded() + { + if (LOG.isDebugEnabled()) + LOG.debug("HTTP2 Response #{} committed", stream.getId()); + send(content, lastContent, callback); + } + + @Override + public void failed(Throwable x) + { + if (LOG.isDebugEnabled()) + LOG.debug("HTTP2 Response #" + stream.getId() + " failed to commit", x); + callback.failed(x); + } + }); } else { @@ -145,7 +160,7 @@ public class HttpTransportOverHTTP2 implements HttpTransport if (LOG.isDebugEnabled()) LOG.debug("HTTP/2 Push {}",request); - + stream.push(new PushPromiseFrame(stream.getId(), 0, request), new Promise<Stream>() { @Override @@ -211,21 +226,4 @@ public class HttpTransportOverHTTP2 implements HttpTransport if (stream != null) stream.reset(new ResetFrame(stream.getId(), ErrorCode.INTERNAL_ERROR.code), Callback.NOOP); } - - private class CommitCallback implements Callback.NonBlocking - { - @Override - public void succeeded() - { - if (LOG.isDebugEnabled()) - LOG.debug("HTTP2 Response #{} committed", stream.getId()); - } - - @Override - public void failed(Throwable x) - { - if (LOG.isDebugEnabled()) - LOG.debug("HTTP2 Response #" + stream.getId() + " failed to commit", x); - } - } } |