Top Description Inners Fields Constructors Methods
org.eclipse.jetty.quic.common

public abstract Class QuicSession

extends ContainerLifeCycle
Class Inheritance
Imports
java.io.IOException, java.net.SocketAddress, java.nio.ByteBuffer, java.nio.channels.ClosedChannelException, java.util.Arrays, .Collection, .EventListener, .List, java.util.concurrent.CompletableFuture, .ConcurrentHashMap, .ConcurrentMap, .Executor, .TimeUnit, java.util.concurrent.atomic.AtomicBoolean, .AtomicLong, java.util.function.Consumer, org.eclipse.jetty.io.ByteBufferPool, .Connection, .CyclicTimeout, .EndPoint, .RetainableByteBuffer, org.eclipse.jetty.quic.quiche.QuicheConnection, .QuicheConnectionId, org.eclipse.jetty.util.BufferUtil, .IteratingCallback, org.eclipse.jetty.util.component.ContainerLifeCycle, .DumpableCollection, org.eclipse.jetty.util.thread.Scheduler, org.slf4j.Logger, .LoggerFactory

Represents a logical connection with a remote peer, identified by a QUIC connection ID.

Each QuicSession maintains a number of QUIC streams, identified by their QUIC stream ID; Each QUIC stream is wrapped in an EndPoint, namely QuicStreamEndPoint.

Bytes received from a QuicConnection in process(SocketAddress, ByteBuffer) are passed to Quiche for processing; in turn, Quiche produces a list of QUIC stream IDs that have pending I/O events, either read-ready or write-ready.

On the receive side, a QuicSession fans-out to multiple QuicStreamEndPoints.

On the send side, many QuicStreamEndPoints fan-in to a QuicSession.

See Also
ProtocolSession

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
public static interface
QuicSession.Listener

A listener for QuicSession events.

Field Summary

Modifier and TypeField and Description
private final ByteBufferPool
private final QuicConnection
private final ConcurrentMap<Long, QuicStreamEndPoint>
private final Executor
private final QuicSession.Flusher
private long
private final AtomicLong[]
private static final Logger
private volatile ProtocolSession
private final QuicheConnection
private QuicheConnectionId
private SocketAddress
private final Scheduler

Constructor Summary

AccessConstructor and Description
protected
QuicSession(Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, QuicheConnection quicheConnection, QuicConnection connection, SocketAddress remoteAddress)

Method Summary

Modifier and TypeMethod and Description
protected abstract ProtocolSession
protected void
doStart()

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

Starts the managed lifecycle beans in the order they were added.

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 out, String 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.

public int
fill(long streamId, ByteBuffer buffer)

private void
public int
flush(long streamId, ByteBuffer buffer, boolean last)

public void
public ByteBufferPool
public QuicheConnectionId
public Executor
public long
public SocketAddress
public int
public String
public QuicStreamEndPoint
public ProtocolSession
public QuicConnection
public Collection<QuicStreamEndPoint>
pack-priv List<Long>
public SocketAddress
public CloseInfo
public Scheduler
pack-priv QuicStreamEndPoint
getStreamEndPoint(long streamId)

public long
public long
getWindowCapacity(long streamId)

pack-priv List<Long>
public void
inwardClose(long error, String reason)

public boolean
public boolean
isFinished(long streamId)

public abstract Connection
private QuicStreamEndPoint
newQuicStreamEndPoint(long streamId)

public long
newStreamId(StreamType
the stream type
streamType
)

Returns: a new stream ID for the given type

private void
private void
public void
public boolean
public void
outwardClose(long error, String reason)

protected Runnable
public Runnable
process(SocketAddress remoteAddress, ByteBuffer cipherBufferIn)

public void
remove(QuicStreamEndPoint endPoint, Throwable failure)

public void
setConnectionId(QuicheConnectionId quicheConnectionId)

public void
setIdleTimeout(long idleTimeout)

public CompletableFuture<Void>
public void
shutdownInput(long streamId, long error)

public void
shutdownOutput(long streamId, long error)

public String
toString()

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

Returns a string representation of the object.

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

Field Detail

byteBufferPoolback to summary
private final ByteBufferPool byteBufferPool
connectionback to summary
private final QuicConnection connection
endPointsback to summary
private final ConcurrentMap<Long, QuicStreamEndPoint> endPoints
executorback to summary
private final Executor executor
flusherback to summary
private final QuicSession.Flusher flusher
idleTimeoutback to summary
private long idleTimeout
idsback to summary
private final AtomicLong[] ids
LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.util.component.ContainerLifeCycle.LOG.

protocolSessionback to summary
private volatile ProtocolSession protocolSession
quicheConnectionback to summary
private final QuicheConnection quicheConnection
quicheConnectionIdback to summary
private QuicheConnectionId quicheConnectionId
remoteAddressback to summary
private SocketAddress remoteAddress
schedulerback to summary
private final Scheduler scheduler

Constructor Detail

QuicSessionback to summary
protected QuicSession(Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, QuicheConnection quicheConnection, QuicConnection connection, SocketAddress remoteAddress)

Method Detail

createProtocolSessionback to summary
protected abstract ProtocolSession createProtocolSession()
doStartback to summary
protected void doStart() throws Exception

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

Doc from org.eclipse.jetty.util.component.ContainerLifeCycle.doStart.

Starts the managed lifecycle beans in the order they were added.

Annotations
@Override
Exceptions
Exception:

Doc from org.eclipse.jetty.util.component.AbstractLifeCycle.doStart.

If there was a problem starting. Will cause a transition to FAILED state

doStopback to summary
protected void doStop() throws Exception

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

Doc from org.eclipse.jetty.util.component.ContainerLifeCycle.doStop.

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

Annotations
@Override
Exceptions
Exception:

Doc from org.eclipse.jetty.util.component.AbstractLifeCycle.doStop.

If there was a problem stopping. Will cause a transition to FAILED state

dumpback to summary
public void dump(Appendable out, String indent) throws IOException

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

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

Doc from org.eclipse.jetty.util.component.Dumpable.dump.

Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.

Annotations
@Override
Exceptions
IOException:
if unable to write to Appendable
fillback to summary
public int fill(long streamId, ByteBuffer buffer) throws IOException
finishOutwardCloseback to summary
private void finishOutwardClose(Throwable failure)
flushback to summary
public int flush(long streamId, ByteBuffer buffer, boolean last) throws IOException
flushback to summary
public void flush()
getByteBufferPoolback to summary
public ByteBufferPool getByteBufferPool()
getConnectionIdback to summary
public QuicheConnectionId getConnectionId()
getExecutorback to summary
public Executor getExecutor()
getIdleTimeoutback to summary
public long getIdleTimeout()
getLocalAddressback to summary
public SocketAddress getLocalAddress()
getMaxLocalStreamsback to summary
public int getMaxLocalStreams()
getNegotiatedProtocolback to summary
public String getNegotiatedProtocol()
getOrCreateStreamEndPointback to summary
public QuicStreamEndPoint getOrCreateStreamEndPoint(long streamId, Consumer<QuicStreamEndPoint> consumer)
getProtocolSessionback to summary
public ProtocolSession getProtocolSession()
getQuicConnectionback to summary
public QuicConnection getQuicConnection()
getQuicStreamEndPointsback to summary
public Collection<QuicStreamEndPoint> getQuicStreamEndPoints()
getReadableStreamIdsback to summary
pack-priv List<Long> getReadableStreamIds()
getRemoteAddressback to summary
public SocketAddress getRemoteAddress()
getRemoteCloseInfoback to summary
public CloseInfo getRemoteCloseInfo()
getSchedulerback to summary
public Scheduler getScheduler()
getStreamEndPointback to summary
pack-priv QuicStreamEndPoint getStreamEndPoint(long streamId)
getWindowCapacityback to summary
public long getWindowCapacity()
getWindowCapacityback to summary
public long getWindowCapacity(long streamId) throws IOException
getWritableStreamIdsback to summary
pack-priv List<Long> getWritableStreamIds()
inwardCloseback to summary
public void inwardClose(long error, String reason)
isConnectionEstablishedback to summary
public boolean isConnectionEstablished()
isFinishedback to summary
public boolean isFinished(long streamId)
newConnectionback to summary
public abstract Connection newConnection(QuicStreamEndPoint endPoint)
newQuicStreamEndPointback to summary
private QuicStreamEndPoint newQuicStreamEndPoint(long streamId)
newStreamIdback to summary
public long newStreamId(StreamType streamType)
Parameters
streamType:StreamType

the stream type

Returns:long

a new stream ID for the given type

notifyClosedback to summary
private void notifyClosed(QuicSession.Listener listener)
notifyOpenedback to summary
private void notifyOpened(QuicSession.Listener listener)
onFailureback to summary
public void onFailure(Throwable failure)
onIdleTimeoutback to summary
public boolean onIdleTimeout()
outwardCloseback to summary
public void outwardClose(long error, String reason)
pollTaskback to summary
protected Runnable pollTask()
processback to summary
public Runnable process(SocketAddress remoteAddress, ByteBuffer cipherBufferIn) throws IOException
removeback to summary
public void remove(QuicStreamEndPoint endPoint, Throwable failure)
setConnectionIdback to summary
public void setConnectionId(QuicheConnectionId quicheConnectionId)
setIdleTimeoutback to summary
public void setIdleTimeout(long idleTimeout)
shutdownback to summary
public CompletableFuture<Void> shutdown()
shutdownInputback to summary
public void shutdownInput(long streamId, long error) throws IOException
shutdownOutputback to summary
public void shutdownOutput(long streamId, long error) throws IOException
toStringback to summary
public String toString()

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

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
org.eclipse.jetty.quic.common back to summary

private Class QuicSession.Flusher

extends IteratingCallback
Class Inheritance

Field Summary

Modifier and TypeField and Description
private RetainableByteBuffer
private final CyclicTimeout

Constructor Summary

AccessConstructor and Description
public
Flusher(Scheduler scheduler)

Method Summary

Modifier and TypeMethod and Description
private void
finish(Throwable failure)

public Invocable.InvocationType
protected void
onCompleteFailure(Throwable failure)

Overrides org.eclipse.jetty.util.IteratingCallback.onCompleteFailure.

Invoked when the overall task has completed with a failure.

protected void
onCompleteSuccess()

Overrides org.eclipse.jetty.util.IteratingCallback.onCompleteSuccess.

Invoked when the overall task has completed successfully.

protected IteratingCallback.Action
process()

Implements abstract org.eclipse.jetty.util.IteratingCallback.process.

Method called by iterate() to process the asynchronous sub-task.

public void
succeeded()

Overrides org.eclipse.jetty.util.IteratingCallback.succeeded.

Overrides default org.eclipse.jetty.util.Callback.succeeded.

Method to invoke when the asynchronous sub-task succeeds.

Inherited from org.eclipse.jetty.util.IteratingCallback:
abortclosefailedisAbortedisClosedisFailedisSucceedediterateresettoString

Field Detail

cipherBufferback to summary
private RetainableByteBuffer cipherBuffer
timeoutback to summary
private final CyclicTimeout timeout

Constructor Detail

Flusherback to summary
public Flusher(Scheduler scheduler)

Method Detail

finishback to summary
private void finish(Throwable failure)
getInvocationTypeback to summary
public Invocable.InvocationType getInvocationType()

Overrides default org.eclipse.jetty.util.thread.Invocable.getInvocationType.

Annotations
@Override
onCompleteFailureback to summary
protected void onCompleteFailure(Throwable failure)

Overrides org.eclipse.jetty.util.IteratingCallback.onCompleteFailure.

Doc from org.eclipse.jetty.util.IteratingCallback.onCompleteFailure.

Invoked when the overall task has completed with a failure.

Annotations
@Override
onCompleteSuccessback to summary
protected void onCompleteSuccess()

Overrides org.eclipse.jetty.util.IteratingCallback.onCompleteSuccess.

Doc from org.eclipse.jetty.util.IteratingCallback.onCompleteSuccess.

Invoked when the overall task has completed successfully.

Annotations
@Override
processback to summary
protected IteratingCallback.Action process() throws IOException

Implements abstract org.eclipse.jetty.util.IteratingCallback.process.

Doc from org.eclipse.jetty.util.IteratingCallback.process.

Method called by iterate() to process the asynchronous sub-task.

Implementations must initiate the asynchronous execution of the sub-task (if any) and return an appropriate action:

  • Action#IDLE when no sub tasks are available for execution but the overall job is not completed yet
  • Action#SCHEDULED when the sub task asynchronous execution has been started
  • Action#SUCCEEDED when the overall job is completed
Annotations
@Override
succeededback to summary
public void succeeded()

Overrides org.eclipse.jetty.util.IteratingCallback.succeeded.

Overrides default org.eclipse.jetty.util.Callback.succeeded.

Doc from org.eclipse.jetty.util.IteratingCallback.succeeded.

Method to invoke when the asynchronous sub-task succeeds.

Subclasses that override this method must always remember to call super.succeeded().

Annotations
@Override
org.eclipse.jetty.quic.common back to summary

public Interface QuicSession.Listener

extends EventListener
Known Direct Implementers
org.eclipse.jetty.quic.common.QuicSessionContainer

A listener for QuicSession events.

Method Summary

Modifier and TypeMethod and Description
public default void
onClosed(QuicSession
the session
session
)

Callback method invoked when a QuicSession is closed.

public default void
onOpened(QuicSession
the session
session
)

Callback method invoked when a QuicSession is opened.

Method Detail

onClosedback to summary
public default void onClosed(QuicSession session)

Callback method invoked when a QuicSession is closed.

Parameters
session:QuicSession

the session

onOpenedback to summary
public default void onOpened(QuicSession session)

Callback method invoked when a QuicSession is opened.

Parameters
session:QuicSession

the session