Moved method onFlushed() to ISession.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2018-04-25 15:11:24 +02:00
parent d64d0348b7
commit c4e1e8f454
3 changed files with 13 additions and 3 deletions

View File

@ -199,8 +199,7 @@ public class HTTP2Connection extends AbstractConnection implements WriteFlusher.
@Override @Override
public void onFlushed(long bytes) throws IOException public void onFlushed(long bytes) throws IOException
{ {
// TODO: add method to ISession ? session.onFlushed(bytes);
((HTTP2Session)session).onFlushed(bytes);
} }
protected class HTTP2Producer implements ExecutionStrategy.Producer protected class HTTP2Producer implements ExecutionStrategy.Producer

View File

@ -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); flusher.onFlushed(bytes);
} }

View File

@ -18,6 +18,8 @@
package org.eclipse.jetty.http2; package org.eclipse.jetty.http2;
import java.io.IOException;
import org.eclipse.jetty.http2.api.Session; import org.eclipse.jetty.http2.api.Session;
import org.eclipse.jetty.http2.api.Stream; import org.eclipse.jetty.http2.api.Stream;
import org.eclipse.jetty.http2.frames.DataFrame; import org.eclipse.jetty.http2.frames.DataFrame;
@ -129,6 +131,14 @@ public interface ISession extends Session
*/ */
public void onFrame(Frame frame); public void onFrame(Frame frame);
/**
* <p>Callback method invoked when bytes are flushed to the network.</p>
*
* @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 * @return the number of bytes written by this session
*/ */