Top Inners Fields Constructors Methods
org.eclipse.jetty.http2

public abstract Class HTTP2Session

extends ContainerLifeCycle
implements Session, Listener
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.http2.parser.Parser.Listener, org.eclipse.jetty.http2.api.Session
Annotations
@ManagedObject
Imports
java.io.IOException, java.net.InetSocketAddress, .SocketAddress, java.nio.channels.ClosedChannelException, java.nio.charset.StandardCharsets, java.util.ArrayDeque, .ArrayList, .Collection, .Collections, .Iterator, .List, .Map, .Queue, java.util.concurrent.CompletableFuture, .ConcurrentHashMap, .TimeoutException, java.util.concurrent.atomic.AtomicInteger, .AtomicLong, java.util.function.Consumer, .Predicate, java.util.stream.Collectors, org.eclipse.jetty.http.MetaData, org.eclipse.jetty.http2.api.Session, .Stream, org.eclipse.jetty.http2.frames.DataFrame, .FailureFrame, .Frame, .FrameType, .GoAwayFrame, .HeadersFrame, .PingFrame, .PrefaceFrame, .PriorityFrame, .PushPromiseFrame, .ResetFrame, .SettingsFrame, .StreamFrame, .WindowUpdateFrame, org.eclipse.jetty.http2.generator.Generator, org.eclipse.jetty.http2.hpack.HpackEncoder, .HpackException, org.eclipse.jetty.http2.internal.HTTP2Flusher, org.eclipse.jetty.http2.parser.Parser, org.eclipse.jetty.io.ByteBufferPool, .CyclicTimeouts, .EndPoint, .WriteFlusher, org.eclipse.jetty.util.AtomicBiInteger, .Atomics, .Callback, .CountingCallback, .MathUtils, .NanoTime, .Promise, org.eclipse.jetty.util.annotation.ManagedAttribute, .ManagedObject, org.eclipse.jetty.util.component.ContainerLifeCycle, .DumpableCollection, org.eclipse.jetty.util.thread.AutoLock, .Invocable, .Scheduler, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class
public abstract static class
private class
private class
HTTP2Session.StreamsState

The HTTP/2 specification requires that stream ids are monotonically increasing, see RFC 7540, 5.1.1.

private class

Field Summary

Modifier and TypeField and Description
private final AtomicLong
private boolean
private final EndPoint
private final FlowControlStrategy
private final HTTP2Flusher
private final Generator
private int
private final AtomicInteger
private final Session.Listener
private final AtomicInteger
private final AtomicInteger
private static final Logger
private int
private int
private int
private final Parser
private boolean
private final AtomicInteger
private final AtomicBiInteger
private final AtomicInteger
private long
private final Map<Integer, HTTP2Stream>
private final AtomicLong
private final AtomicLong
private final HTTP2Session.StreamsState
private final HTTP2Session.StreamTimeouts
private int

Constructor Summary

AccessConstructor and Description
public
HTTP2Session(Scheduler scheduler, EndPoint endPoint, Parser parser, Generator generator, Session.Listener listener, FlowControlStrategy flowControl, int initialStreamId)

Method Summary

Modifier and TypeMethod and Description
protected void
abort(String reason, Throwable failure, Callback callback)

public boolean
close(int
the error code
error
,
String
the reason
reason
,
Callback
the callback to invoke when the operation is complete
callback
)

Implements org.eclipse.jetty.http2.api.Session.close.

Invoked internally and by applications to send a GO_AWAY frame to the other peer.

private void
configure(Map<Integer, Integer> settings, boolean local)

private void
control(HTTP2Stream stream, Callback callback, Frame frame)

protected HTTP2Stream
createLocalStream(int streamId, MetaData.Request request, Consumer<Throwable> failFn)

protected HTTP2Stream
createRemoteStream(int streamId, MetaData.Request request)

public void
data(HTTP2Stream stream, DataFrame frame, Callback callback)

pack-priv void
dataConsumed(HTTP2Stream stream, int length)

public void
protected void
doStop()

Overrides org.eclipse.jetty.util.component.ContainerLifeCycle.doStop.

Stops the managed lifecycle beans in the reverse order they were added.

public void
dump(Appendable
The appendable to dump to
out
,
String
The indent to apply after any new lines.
indent
)

Overrides org.eclipse.jetty.util.component.ContainerLifeCycle.dump.

Implements org.eclipse.jetty.util.component.Dumpable.dump.

Dump this object (and children) into an Appendable using the provided indent after any new lines.

private void
failStream(Stream stream, int error, String reason, Throwable failure, Callback callback)

private void
failStreams(Predicate<Stream> matcher, String reason, boolean reset)

private void
frame(HTTP2Session.Entry entry, boolean flush)

public void
frames(HTTP2Stream stream, List<? extends Frame> frames, Callback callback)

public long
public CloseState
public EndPoint
public FlowControlStrategy
public Generator
public int
protected int
public InetSocketAddress
public SocketAddress
public int
public int
public int
public Parser
public int
public InetSocketAddress
public SocketAddress
public int
public HTTP2Stream
getStream(int
the stream id of the stream looked for
streamId
)

Implements org.eclipse.jetty.http2.api.Session.getStream.

Retrieves the stream with the given streamId.

public int
public long
public Collection<Stream>
public long
public long
public int
public boolean
goAway(GoAwayFrame frame, Callback callback)

protected static boolean
isClientStream(int streamId)

public boolean
public boolean
public boolean
private boolean
isLocalStream(int streamId)

protected boolean
isLocalStreamClosed(int streamId)

public boolean
protected boolean
isRemoteStreamClosed(int streamId)

private boolean
isStreamClosed(int streamId)

private HTTP2Session.Entry
newEntry(Frame frame, HTTP2Stream stream, Callback callback)

private GoAwayFrame
newGoAwayFrame(int error, String reason)

private GoAwayFrame
newGoAwayFrame(int lastRemoteStreamId, int error, String reason)

public void
newStream(HeadersFrame
the HEADERS frame containing the HTTP headers
frame
,
Promise<Stream>
the promise that gets notified of the stream creation
promise
,
Stream.Listener
the listener that gets notified of stream events
listener
)

Implements org.eclipse.jetty.http2.api.Session.newStream.

Sends the given HEADERS frame to create a new Stream.

public void
protected HTTP2Stream
newStream(int streamId, MetaData.Request request, boolean local)

public Stream
newUpgradeStream(HeadersFrame
the HEADERS frame that triggered the stream creation allocated stream id, or null if not interested in the modified headers frame
frame
,
Stream.Listener
the listener that gets notified of stream events
listener
,
Consumer<Throwable> failFn)

Creates a new stream allocating a stream id if the given HEADERS frame does not have one.

private void
protected void
notifyClose(Session session, GoAwayFrame frame, Callback callback)

protected void
notifyFailure(Session session, Throwable failure, Callback callback)

protected void
protected boolean
protected Stream.Listener
protected void
notifyPing(Session session, PingFrame frame)

protected void
notifyReset(Session session, ResetFrame frame)

protected void
public void
public void
public void
private void
onFailure(int error, String reason, Throwable failure, Callback callback)

public void
onFlushed(long bytes)

public void
onFrame(Frame frame)

public void
onGoAway(GoAwayFrame
the GO_AWAY frame that has been received.
frame
)

Overrides default org.eclipse.jetty.http2.parser.Parser.Listener.onGoAway.

This method is called when receiving a GO_AWAY from the other peer.

public abstract void
public boolean

Returns:

true if the session should be closed, false otherwise
onIdleTimeout
()

This method is invoked when the idle timeout expires.

public void
public void
public void
protected void
private void
onSessionFailure(int error, String reason, Callback callback)

public void
public void
onSettings(SettingsFrame frame, boolean reply)

public void
onShutdown()

This method is called when the TCP FIN is received from the remote peer.

private void
private void
onStreamCreated(int streamId)

private void
onStreamDestroyed(int streamId)

public void
protected final void
public void
public void
public void
public void
ping(PingFrame
the PING frame to send
frame
,
Callback
the callback that gets notified when the frame has been sent
callback
)

Implements org.eclipse.jetty.http2.api.Session.ping.

Sends the given PING frame.

public int
priority(PriorityFrame
the PRIORITY frame to send
frame
,
Callback
the callback that gets notified when the frame has been sent
callback
)

Implements org.eclipse.jetty.http2.api.Session.priority.

Sends the given PRIORITY frame.

public void
push(Stream stream, Promise<Stream> promise, PushPromiseFrame frame, Stream.Listener listener)

public boolean
pack-priv void
reset(HTTP2Stream stream, ResetFrame frame, Callback callback)

pack-priv void
public void
setConnectProtocolEnabled(boolean connectProtocolEnabled)

public void
setInitialSessionRecvWindow(int initialSessionRecvWindow)

public void
setMaxEncoderTableCapacity(int maxEncoderTableCapacity)

public void
setMaxLocalStreams(int maxLocalStreams)

public void
setMaxRemoteStreams(int maxRemoteStreams)

public void
setStreamIdleTimeout(long streamIdleTimeout)

public void
settings(SettingsFrame
the SETTINGS frame to send
frame
,
Callback
the callback that gets notified when the frame has been sent
callback
)

Implements org.eclipse.jetty.http2.api.Session.settings.

Sends the given SETTINGS frame to configure the session.

public void
setWriteThreshold(int writeThreshold)

public CompletableFuture<Void>
shutdown()

Implements org.eclipse.jetty.http2.api.Session.shutdown.

Gracefully closes the session, returning a CompletableFuture that is completed when all the streams currently being processed are completed.

private void
private Throwable
toFailure(int error, String reason)

public String
toString()

Overrides org.eclipse.jetty.util.component.AbstractLifeCycle.toString.

Returns a string representation of the object.

protected void
public int
updateRecvWindow(int delta)

public int
updateSendWindow(int delta)

pack-priv void
updateStreamCount(boolean local, int deltaStreams, int deltaClosing)

Inherited from org.eclipse.jetty.util.component.ContainerLifeCycle:
addBeanaddBeanaddEventListeneraddManagedcontainsdestroydoStartdumpdumpdumpObjectsdumpStdErrgetBeangetBeansgetBeansgetContainedBeansgetContainedBeansisAutoisManagedisUnmanagedmanageremoveBeanremoveBeansremoveEventListenersetBeansstartstopunmanageupdateBeanupdateBeanupdateBeansupdateBeans