From c4e1e8f4541d853dc47822418b0c8be18cfe38ab Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Wed, 25 Apr 2018 15:11:24 +0200 Subject: [PATCH] Moved method onFlushed() to ISession. Signed-off-by: Simone Bordet --- .../java/org/eclipse/jetty/http2/HTTP2Connection.java | 3 +-- .../java/org/eclipse/jetty/http2/HTTP2Session.java | 3 ++- .../main/java/org/eclipse/jetty/http2/ISession.java | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java index 13babfd304a..db65721cb20 100644 --- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java +++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java @@ -199,8 +199,7 @@ public class HTTP2Connection extends AbstractConnection implements WriteFlusher. @Override public void onFlushed(long bytes) throws IOException { - // TODO: add method to ISession ? - ((HTTP2Session)session).onFlushed(bytes); + session.onFlushed(bytes); } protected class HTTP2Producer implements ExecutionStrategy.Producer diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java index 73459acc19f..6ee22959696 100644 --- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java +++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java @@ -975,7 +975,8 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio { } - void onFlushed(long bytes) throws IOException + @Override + public void onFlushed(long bytes) throws IOException { flusher.onFlushed(bytes); } diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/ISession.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/ISession.java index d26836a7852..70d8885b7c5 100644 --- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/ISession.java +++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/ISession.java @@ -18,6 +18,8 @@ package org.eclipse.jetty.http2; +import java.io.IOException; + import org.eclipse.jetty.http2.api.Session; import org.eclipse.jetty.http2.api.Stream; import org.eclipse.jetty.http2.frames.DataFrame; @@ -129,6 +131,14 @@ public interface ISession extends Session */ public void onFrame(Frame frame); + /** + *

Callback method invoked when bytes are flushed to the network.

+ * + * @param bytes the number of bytes flushed to the network + * @throws IOException if the flush should fail + */ + public void onFlushed(long bytes) throws IOException; + /** * @return the number of bytes written by this session */