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

public Class HTTP2Connection

extends AbstractConnection
implements Listener, Listener, UpgradeTo
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.io.Connection.UpgradeTo, org.eclipse.jetty.io.WriteFlusher.Listener, org.eclipse.jetty.http2.parser.Parser.Listener
Imports
java.io.IOException, java.nio.ByteBuffer, java.util.ArrayDeque, .Queue, java.util.concurrent.Executor, .TimeoutException, java.util.concurrent.atomic.AtomicLong, org.eclipse.jetty.http2.api.Stream, org.eclipse.jetty.http2.frames.DataFrame, .GoAwayFrame, .HeadersFrame, .PingFrame, .PriorityFrame, .PushPromiseFrame, .ResetFrame, .SettingsFrame, .WindowUpdateFrame, org.eclipse.jetty.http2.parser.Parser, org.eclipse.jetty.io.AbstractConnection, .ByteBufferPool, .Connection, .EndPoint, .Retainable, .RetainableByteBuffer, .WriteFlusher, org.eclipse.jetty.util.BufferUtil, .Callback, org.eclipse.jetty.util.component.LifeCycle, org.eclipse.jetty.util.thread.AutoLock, .ExecutionStrategy, org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
protected class
private class
private static class

Field Summary

Modifier and TypeField and Description
private final ByteBufferPool
private final int
private final AtomicLong
private final AutoLock
private static final Logger
private final HTTP2Connection.HTTP2Producer
private final HTTP2Session
private final ExecutionStrategy
private final Queue<Runnable>
private boolean
private boolean

Constructor Summary

AccessConstructor and Description
protected
HTTP2Connection(ByteBufferPool bufferPool, Executor executor, EndPoint endPoint, HTTP2Session session, int bufferSize)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides org.eclipse.jetty.io.AbstractConnection.close.

Implements org.eclipse.jetty.io.Connection.close.

Performs a logical close of this connection.

protected void
private int
fill(EndPoint endPoint, ByteBuffer buffer)

public long
public long
public long
public long
public HTTP2Session
public boolean
public boolean
protected void
offerTask(Runnable task, boolean dispatch)

private void
public void
onClose(Throwable
The cause of the close or null for a normal close
cause
)

Overrides org.eclipse.jetty.io.AbstractConnection.onClose.

Implements org.eclipse.jetty.io.Connection.onClose.

Callback method invoked when this connection is closed.

public void
public void
public void
onFillable()

Implements abstract org.eclipse.jetty.io.AbstractConnection.onFillable.

Callback method invoked when the endpoint is ready to be read.

public void
onFlushed(long
the number of bytes flushed
bytes
)

Implements org.eclipse.jetty.io.WriteFlusher.Listener.onFlushed.

Invoked when a WriteFlusher flushed bytes in a non-blocking way, as part of a - possibly larger - write.

public void
public void
public boolean
onIdleExpired(TimeoutException timeoutException)

Overrides org.eclipse.jetty.io.AbstractConnection.onIdleExpired.

Implements org.eclipse.jetty.io.Connection.onIdleExpired.

Callback method invoked upon an idle timeout event.

public void
onOpen()

Overrides org.eclipse.jetty.io.AbstractConnection.onOpen.

Implements org.eclipse.jetty.io.Connection.onOpen.

Callback method invoked when this connection is opened.

public void
public void
public void
public void
public void
public void
public void
onUpgradeTo(ByteBuffer
a non-null buffer of unconsumed bytes received from the upgrade-from connection. The buffer does not belong to any pool and should be discarded after having consumed its bytes.
buffer
)

Implements org.eclipse.jetty.io.Connection.UpgradeTo.onUpgradeTo.

Invoked during an upgrade to receive a buffer containing bytes that have not been consumed by the upgrade-from connection, and that must be consumed by this connection.

public void
private Runnable
protected void
public void
setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers)

public void
setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers)

Inherited from org.eclipse.jetty.io.AbstractConnection:
addEventListenerfailedCallbackfillInterestedgetCreatedTimeStampgetEndPointgetExecutorgetInputBufferSizegetInvocationTypeisFillInterestedonFillInterestedFailedonReadTimeoutremoveEventListenersetInputBufferSizetoConnectionStringtoStringtryFillInterested

Field Detail

bufferPoolback to summary
private final ByteBufferPool bufferPool
bufferSizeback to summary
private final int bufferSize
bytesInback to summary
private final AtomicLong bytesIn
lockback to summary
private final AutoLock lock
LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.io.AbstractConnection.LOG.

producerback to summary
private final HTTP2Connection.HTTP2Producer producer
sessionback to summary
private final HTTP2Session session
strategyback to summary
private final ExecutionStrategy strategy
tasksback to summary
private final Queue<Runnable> tasks
useInputDirectByteBuffersback to summary
private boolean useInputDirectByteBuffers
useOutputDirectByteBuffersback to summary
private boolean useOutputDirectByteBuffers

Constructor Detail

HTTP2Connectionback to summary
protected HTTP2Connection(ByteBufferPool bufferPool, Executor executor, EndPoint endPoint, HTTP2Session session, int bufferSize)

Method Detail

closeback to summary
public void close()

Overrides org.eclipse.jetty.io.AbstractConnection.close.

Implements org.eclipse.jetty.io.Connection.close.

Doc from org.eclipse.jetty.io.Connection.close.

Performs a logical close of this connection.

For simple connections, this may just mean to delegate the close to the associated EndPoint but, for example, SSL connections should write the SSL close message before closing the associated EndPoint.

Annotations
@Override
dispatchback to summary
protected void dispatch()
fillback to summary
private int fill(EndPoint endPoint, ByteBuffer buffer)
getBytesInback to summary
public long getBytesIn()

Overrides org.eclipse.jetty.io.AbstractConnection.getBytesIn.

Implements org.eclipse.jetty.io.Connection.getBytesIn.

Annotations
@Override
getBytesOutback to summary
public long getBytesOut()

Overrides org.eclipse.jetty.io.AbstractConnection.getBytesOut.

Implements org.eclipse.jetty.io.Connection.getBytesOut.

Annotations
@Override
getMessagesInback to summary
public long getMessagesIn()

Overrides org.eclipse.jetty.io.AbstractConnection.getMessagesIn.

Implements org.eclipse.jetty.io.Connection.getMessagesIn.

Annotations
@Override
getMessagesOutback to summary
public long getMessagesOut()

Overrides org.eclipse.jetty.io.AbstractConnection.getMessagesOut.

Implements org.eclipse.jetty.io.Connection.getMessagesOut.

Annotations
@Override
getSessionback to summary
public HTTP2Session getSession()
isUseInputDirectByteBuffersback to summary
public boolean isUseInputDirectByteBuffers()
isUseOutputDirectByteBuffersback to summary
public boolean isUseOutputDirectByteBuffers()
offerTaskback to summary
protected void offerTask(Runnable task, boolean dispatch)
offerTaskback to summary
private void offerTask(Runnable task)
onCloseback to summary
public void onClose(Throwable cause)

Overrides org.eclipse.jetty.io.AbstractConnection.onClose.

Implements org.eclipse.jetty.io.Connection.onClose.

Doc from org.eclipse.jetty.io.Connection.onClose.

Callback method invoked when this connection is closed.

Creators of the connection implementation are responsible for calling this method.

Parameters
cause:Throwable

The cause of the close or null for a normal close

Annotations
@Override
onConnectionFailureback to summary
public void onConnectionFailure(int error, String reason)

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

Annotations
@Override
onDataback to summary
public void onData(DataFrame frame)

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

Annotations
@Override
onFillableback to summary
public void onFillable()

Implements abstract org.eclipse.jetty.io.AbstractConnection.onFillable.

Doc from org.eclipse.jetty.io.AbstractConnection.onFillable.

Callback method invoked when the endpoint is ready to be read.

Annotations
@Override
onFlushedback to summary
public void onFlushed(long bytes) throws IOException

Implements org.eclipse.jetty.io.WriteFlusher.Listener.onFlushed.

Doc from org.eclipse.jetty.io.WriteFlusher.Listener.onFlushed.

Invoked when a WriteFlusher flushed bytes in a non-blocking way, as part of a - possibly larger - write.

This method may be invoked multiple times, for example when writing a large buffer: a first flush of bytes, then the connection became TCP congested, and a subsequent flush of bytes when the connection became writable again.

This method is never invoked concurrently, but may be invoked by different threads, so implementations may not rely on thread-local variables.

Implementations may throw an IOException to signal that the write should fail, for example if the implementation enforces a minimum data rate.

Parameters
bytes:long

the number of bytes flushed

Annotations
@Override
Exceptions
IOException:
if the write should fail
onGoAwayback to summary
public void onGoAway(GoAwayFrame frame)

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

Annotations
@Override
onHeadersback to summary
public void onHeaders(HeadersFrame frame)

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

Annotations
@Override
onIdleExpiredback to summary
public boolean onIdleExpired(TimeoutException timeoutException)

Overrides org.eclipse.jetty.io.AbstractConnection.onIdleExpired.

Implements org.eclipse.jetty.io.Connection.onIdleExpired.

Doc from org.eclipse.jetty.io.Connection.onIdleExpired.

Callback method invoked upon an idle timeout event.

Implementations of this method may return true to indicate that the idle timeout handling should proceed normally, typically failing the EndPoint and causing it to be closed.

When false is returned, the handling of the idle timeout event is halted immediately and the EndPoint left in the state it was before the idle timeout event.

Returns:boolean

true to let the EndPoint handle the idle timeout, false to tell the EndPoint to halt the handling of the idle timeout.

Annotations
@Override
onOpenback to summary
public void onOpen()

Overrides org.eclipse.jetty.io.AbstractConnection.onOpen.

Implements org.eclipse.jetty.io.Connection.onOpen.

Doc from org.eclipse.jetty.io.Connection.onOpen.

Callback method invoked when this connection is opened.

Creators of the connection implementation are responsible for calling this method.

Annotations
@Override
onPingback to summary
public void onPing(PingFrame frame)

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

Annotations
@Override
onPriorityback to summary
public void onPriority(PriorityFrame frame)

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

Annotations
@Override
onPushPromiseback to summary
public void onPushPromise(PushPromiseFrame frame)

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

Annotations
@Override
onResetback to summary
public void onReset(ResetFrame frame)

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

Annotations
@Override
onSettingsback to summary
public void onSettings(SettingsFrame frame)

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

Annotations
@Override
onStreamFailureback to summary
public void onStreamFailure(int streamId, int error, String reason)

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

Annotations
@Override
onUpgradeToback to summary
public void onUpgradeTo(ByteBuffer buffer)

Implements org.eclipse.jetty.io.Connection.UpgradeTo.onUpgradeTo.

Doc from org.eclipse.jetty.io.Connection.UpgradeTo.onUpgradeTo.

Invoked during an upgrade to receive a buffer containing bytes that have not been consumed by the upgrade-from connection, and that must be consumed by this connection.

Parameters
buffer:ByteBuffer

a non-null buffer of unconsumed bytes received from the upgrade-from connection. The buffer does not belong to any pool and should be discarded after having consumed its bytes.

Annotations
@Override
onWindowUpdateback to summary
public void onWindowUpdate(WindowUpdateFrame frame)

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

Annotations
@Override
pollTaskback to summary
private Runnable pollTask()
produceback to summary
protected void produce()
setUseInputDirectByteBuffersback to summary
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers)
setUseOutputDirectByteBuffersback to summary
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers)
org.eclipse.jetty.http2 back to summary

private Class HTTP2Connection.FillableCallback

extends Object
implements Callback
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.Callback, org.eclipse.jetty.util.thread.Invocable

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
failed(Throwable
the reason for the operation failure
x
)

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

Callback invoked when the operation fails.

public Invocable.InvocationType
public void
succeeded()

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

Callback invoked when the operation completes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

FillableCallbackback to summary
private FillableCallback()

Method Detail

failedback to summary
public void failed(Throwable x)

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

Doc from org.eclipse.jetty.util.Callback.failed.

Callback invoked when the operation fails.

Parameters
x:Throwable

the reason for the operation failure

Annotations
@Override
getInvocationTypeback to summary
public Invocable.InvocationType getInvocationType()

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

Returns:Invocable.InvocationType

Doc from org.eclipse.jetty.util.thread.Invocable.getInvocationType.

The InvocationType of this object

Annotations
@Override
succeededback to summary
public void succeeded()

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

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

Callback invoked when the operation completes.

Annotations
@Override
org.eclipse.jetty.http2 back to summary

protected Class HTTP2Connection.HTTP2Producer

extends Object
implements Producer
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.thread.ExecutionStrategy.Producer

Field Summary

Modifier and TypeField and Description
private boolean
private final Callback
private HTTP2Connection.NetworkBuffer
private boolean

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
private void
public Runnable
private void
private void
private void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

failedback to summary
private boolean failed
fillableCallbackback to summary
private final Callback fillableCallback
networkBufferback to summary
private HTTP2Connection.NetworkBuffer networkBuffer
shutdownback to summary
private boolean shutdown

Constructor Detail

HTTP2Producerback to summary
protected HTTP2Producer()

Method Detail

acquireNetworkBufferback to summary
private void acquireNetworkBuffer()
produceback to summary
public Runnable produce()

Implements org.eclipse.jetty.util.thread.ExecutionStrategy.Producer.produce.

Doc from org.eclipse.jetty.util.thread.ExecutionStrategy.Producer.produce.

Produces a task to be executed.

Returns:Runnable

a task to executed or null if there are no more tasks to execute

Annotations
@Override
reacquireNetworkBufferback to summary
private void reacquireNetworkBuffer()
releaseNetworkBufferback to summary
private void releaseNetworkBuffer()
setInputBufferback to summary
private void setInputBuffer(ByteBuffer byteBuffer)
toStringback to summary
public String toString()

Overrides java.lang.Object.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.

Returns:String

a string representation of the object

Annotations
@Override
org.eclipse.jetty.http2 back to summary

private Class HTTP2Connection.NetworkBuffer

extends Object
implements Retainable
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.io.Retainable

Field Summary

Modifier and TypeField and Description
private final RetainableByteBuffer

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
canRetain()

Overrides default org.eclipse.jetty.io.Retainable.canRetain.

Returns whether this resource is referenced counted by calls to retain() and release().

public ByteBuffer
public boolean
public boolean
private void
put(ByteBuffer source)

public boolean
release()

Overrides default org.eclipse.jetty.io.Retainable.release.

Releases this resource, potentially decrementing a reference count (if any).

public void
retain()

Overrides default org.eclipse.jetty.io.Retainable.retain.

Retains this resource, potentially incrementing a reference count if there are resources that will be released.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final RetainableByteBuffer delegate

Constructor Detail

NetworkBufferback to summary
private NetworkBuffer()

Method Detail

canRetainback to summary
public boolean canRetain()

Overrides default org.eclipse.jetty.io.Retainable.canRetain.

Doc from org.eclipse.jetty.io.Retainable.canRetain.

Returns whether this resource is referenced counted by calls to retain() and release().

Implementations may decide that special resources are not not referenced counted (for example, static constants) so calling retain() is a no-operation, and calling release() on those special resources is a no-operation that always returns true.

Returns:boolean

true if calls to retain() are reference counted.

Annotations
@Override
getBufferback to summary
public ByteBuffer getBuffer()
hasRemainingback to summary
public boolean hasRemaining()
isRetainedback to summary
public boolean isRetained()
putback to summary
private void put(ByteBuffer source)
releaseback to summary
public boolean release()

Overrides default org.eclipse.jetty.io.Retainable.release.

Doc from org.eclipse.jetty.io.Retainable.release.

Releases this resource, potentially decrementing a reference count (if any).

Returns:boolean

true when the reference count goes to zero or if there was no reference count, false otherwise.

Annotations
@Override
retainback to summary
public void retain()

Overrides default org.eclipse.jetty.io.Retainable.retain.

Doc from org.eclipse.jetty.io.Retainable.retain.

Retains this resource, potentially incrementing a reference count if there are resources that will be released.

Annotations
@Override
org.eclipse.jetty.http2 back to summary

private Class HTTP2Connection.StreamData

extends Data
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Retainable

Constructor Summary

AccessConstructor and Description
private
StreamData(DataFrame frame, Retainable retainable)

Method Summary

Modifier and TypeMethod and Description
public boolean
canRetain()

Overrides default org.eclipse.jetty.io.Retainable.canRetain.

Returns whether this resource is referenced counted by calls to retain() and release().

public boolean
release()

Overrides default org.eclipse.jetty.io.Retainable.release.

Releases this resource, potentially decrementing a reference count (if any).

public void
retain()

Overrides default org.eclipse.jetty.io.Retainable.retain.

Retains this resource, potentially incrementing a reference count if there are resources that will be released.

Inherited from org.eclipse.jetty.http2.api.Stream.Data:
eofframetoString

Field Detail

retainableback to summary
private final Retainable retainable

Constructor Detail

StreamDataback to summary
private StreamData(DataFrame frame, Retainable retainable)

Method Detail

canRetainback to summary
public boolean canRetain()

Overrides default org.eclipse.jetty.io.Retainable.canRetain.

Doc from org.eclipse.jetty.io.Retainable.canRetain.

Returns whether this resource is referenced counted by calls to retain() and release().

Implementations may decide that special resources are not not referenced counted (for example, static constants) so calling retain() is a no-operation, and calling release() on those special resources is a no-operation that always returns true.

Returns:boolean

true if calls to retain() are reference counted.

Annotations
@Override
releaseback to summary
public boolean release()

Overrides default org.eclipse.jetty.io.Retainable.release.

Doc from org.eclipse.jetty.io.Retainable.release.

Releases this resource, potentially decrementing a reference count (if any).

Returns:boolean

true when the reference count goes to zero or if there was no reference count, false otherwise.

Annotations
@Override
retainback to summary
public void retain()

Overrides default org.eclipse.jetty.io.Retainable.retain.

Doc from org.eclipse.jetty.io.Retainable.retain.

Retains this resource, potentially incrementing a reference count if there are resources that will be released.

Annotations
@Override