public class TransportImpl extends EndpointImpl implements ProtonJTransport, FrameBody.FrameBodyHandler<java.lang.Integer>, FrameHandler, TransportInternal
Transport.FactoryDEFAULT_MAX_FRAME_SIZE, END_OF_STREAM, MIN_MAX_FRAME_SIZE, SESSION_WINDOW, TRACE_DRV, TRACE_FRM, TRACE_OFF, TRACE_RAW| Constructor and Description |
|---|
TransportImpl()
Application code should use
Transport.Factory.create() instead |
| Modifier and Type | Method and Description |
|---|---|
void |
addTransportLayer(TransportLayer layer)
Add a
TransportLayer to the transport, wrapping the input and output process handlers
in the state they currently exist. |
void |
bind(Connection conn) |
int |
capacity() |
void |
close_head() |
void |
close_tail() |
void |
closed(TransportException error) |
int |
getChannelMax()
Gets the local channel-max value to be advertised to the remote peer
|
ErrorCondition |
getCondition() |
protected ConnectionImpl |
getConnectionImpl() |
long |
getFramesInput() |
long |
getFramesOutput() |
int |
getIdleTimeout() |
java.nio.ByteBuffer |
getInputBuffer()
Get a buffer that can be used to write input data into the transport.
|
int |
getMaxFrameSize()
Get the maximum frame size for the transport
|
int |
getOutboundFrameSizeLimit() |
java.nio.ByteBuffer |
getOutputBuffer()
Get a read-only byte buffer containing the transport's pending output.
|
ProtocolTracer |
getProtocolTracer() |
Reactor |
getReactor() |
int |
getRemoteChannelMax()
Gets the remote value of channel-max, as advertised by the peer on its
Open frame.
|
int |
getRemoteIdleTimeout() |
int |
getRemoteMaxFrameSize() |
Selectable |
getSelectable() |
void |
handleAttach(Attach attach,
Binary payload,
java.lang.Integer channel) |
void |
handleBegin(Begin begin,
Binary payload,
java.lang.Integer channel) |
void |
handleClose(Close close,
Binary payload,
java.lang.Integer channel) |
void |
handleDetach(Detach detach,
Binary payload,
java.lang.Integer channel) |
void |
handleDisposition(Disposition disposition,
Binary payload,
java.lang.Integer channel) |
void |
handleEnd(End end,
Binary payload,
java.lang.Integer channel) |
void |
handleFlow(Flow flow,
Binary payload,
java.lang.Integer channel) |
boolean |
handleFrame(TransportFrame frame) |
void |
handleOpen(Open open,
Binary payload,
java.lang.Integer channel) |
void |
handleTransfer(Transfer transfer,
Binary payload,
java.lang.Integer channel) |
java.nio.ByteBuffer |
head() |
int |
input(byte[] bytes,
int offset,
int length)
Processes the provided input.
|
boolean |
isClosed() |
boolean |
isEmitFlowEventOnSend() |
boolean |
isHandlingFrames()
Returns whether I am currently able to handle frames.
|
boolean |
isUseReadOnlyOutputBuffer() |
TransportResult |
oldApiCheckStateBeforeInput(int inputLength)
This method is public as it is used by Python layer.
|
int |
output(byte[] bytes,
int offset,
int size)
Has the transport produce up to size bytes placing the result
into dest beginning at position offset.
|
void |
outputConsumed()
Informs the transport that the output buffer returned by
Transport.getOutputBuffer()
is finished with, allowing implementation-dependent steps to be performed such as
reclaiming buffer space. |
int |
pending() |
void |
pop(int bytes) |
void |
process() |
TransportResult |
processInput()
Tell the transport to process the data written to the input buffer.
|
Sasl |
sasl()
Signal the transport to expect SASL frames used to establish a SASL layer prior to
performing the AMQP protocol version negotiation.
|
void |
setChannelMax(int channelMax)
Set the local value of channel-max, to be advertised to the peer on the
Open frame emitted by the transport.
|
void |
setCondition(ErrorCondition error)
Set the local error condition
|
void |
setEmitFlowEventOnSend(boolean emitFlowEventOnSend)
Configure whether a synthetic Flow event should be emitted when messages are sent,
reflecting a change in the credit level on the link that may prompt other action.
|
void |
setFrameHandler(FrameHandler frameHandler)
Override the default frame handler.
|
void |
setIdleTimeout(int timeout) |
void |
setInitialRemoteMaxFrameSize(int remoteMaxFrameSize)
Allows overriding the initial remote-max-frame-size to a value greater than the default 512bytes.
|
void |
setMaxFrameSize(int maxFrameSize) |
void |
setOutboundFrameSizeLimit(int limit)
Set an upper limit on the size of outgoing frames that will be sent
to the peer.
|
void |
setProtocolTracer(ProtocolTracer protocolTracer) |
void |
setReactor(Reactor reactor) |
void |
setSelectable(Selectable selectable) |
void |
setUseReadOnlyOutputBuffer(boolean value) |
Ssl |
ssl(SslDomain sslDomain)
Equivalent to
Transport.ssl(SslDomain, SslPeerDetails) but passing null for SslPeerDetails, meaning no SNI detail
is sent, hostname verification isn't supported etc when connecting. |
Ssl |
ssl(SslDomain sslDomain,
SslPeerDetails sslPeerDetails)
Wrap this transport's output and input to apply SSL encryption and decryption respectively.
|
java.nio.ByteBuffer |
tail() |
long |
tick(long now)
Prompt the transport to perform work such as idle-timeout/heartbeat handling, and return an
absolute deadline in milliseconds that tick must again be called by/at, based on the provided
current time in milliseconds, to ensure the periodic work is carried out as necessary.
|
java.lang.String |
toString() |
void |
trace(int levels) |
void |
unbind() |
protected void |
writeFrame(int channel,
FrameBody frameBody,
ReadableBuffer payload,
java.lang.Runnable onPayloadTooLarge) |
boolean |
writeInto(java.nio.ByteBuffer outputBuffer)
Writes my pending output bytes into outputBuffer.
|
attachments, close, free, getContext, getLocalState, getRemoteCondition, getRemoteState, open, setContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclose, free, getContext, getLocalState, getRemoteCondition, getRemoteState, open, setContextattachmentspublic TransportImpl()
Transport.Factory.create() insteadpublic int getMaxFrameSize()
TransportgetMaxFrameSize in interface Transportpublic int getRemoteMaxFrameSize()
getRemoteMaxFrameSize in interface Transportpublic void setInitialRemoteMaxFrameSize(int remoteMaxFrameSize)
TransportTransport.sasl() in order to influence SASL behaviour.setInitialRemoteMaxFrameSize in interface TransportremoteMaxFrameSize - the remote frame size to usepublic void setMaxFrameSize(int maxFrameSize)
setMaxFrameSize in interface Transportpublic int getChannelMax()
TransportgetChannelMax in interface TransportTransport.setChannelMax(int)public void setChannelMax(int channelMax)
TransportTransport.getRemoteChannelMax().setChannelMax in interface TransportchannelMax - the local channel-max to advertise to the peer, in range [0 - 2^16).public int getRemoteChannelMax()
TransportTransport.getChannelMax().getRemoteChannelMax in interface Transportpublic ErrorCondition getCondition()
getCondition in interface EndpointgetCondition in interface TransportgetCondition in class EndpointImplpublic void setCondition(ErrorCondition error)
EndpointsetCondition in interface EndpointsetCondition in class EndpointImplpublic void bind(Connection conn)
public int input(byte[] bytes,
int offset,
int length)
Transportpublic TransportResult oldApiCheckStateBeforeInput(int inputLength)
Transport.input(byte[], int, int)public int output(byte[] bytes,
int offset,
int size)
Transportpublic boolean writeInto(java.nio.ByteBuffer outputBuffer)
public Sasl sasl()
TransportSasl object.public Ssl ssl(SslDomain sslDomain, SslPeerDetails sslPeerDetails)
Ssl object, regardless of the parameters supplied.
Note that sslDomain must implement ProtonSslEngineProvider.
This is not possible enforce at the API level because ProtonSslEngineProvider is not part of the
public Proton API.
public Ssl ssl(SslDomain sslDomain)
TransportTransport.ssl(SslDomain, SslPeerDetails) but passing null for SslPeerDetails, meaning no SNI detail
is sent, hostname verification isn't supported etc when connecting.protected void writeFrame(int channel,
FrameBody frameBody,
ReadableBuffer payload,
java.lang.Runnable onPayloadTooLarge)
protected ConnectionImpl getConnectionImpl()
getConnectionImpl in class EndpointImplpublic void handleOpen(Open open, Binary payload, java.lang.Integer channel)
handleOpen in interface FrameBody.FrameBodyHandler<java.lang.Integer>public void handleBegin(Begin begin, Binary payload, java.lang.Integer channel)
handleBegin in interface FrameBody.FrameBodyHandler<java.lang.Integer>public void handleAttach(Attach attach, Binary payload, java.lang.Integer channel)
handleAttach in interface FrameBody.FrameBodyHandler<java.lang.Integer>public void handleFlow(Flow flow, Binary payload, java.lang.Integer channel)
handleFlow in interface FrameBody.FrameBodyHandler<java.lang.Integer>public void handleTransfer(Transfer transfer, Binary payload, java.lang.Integer channel)
handleTransfer in interface FrameBody.FrameBodyHandler<java.lang.Integer>public void handleDisposition(Disposition disposition, Binary payload, java.lang.Integer channel)
handleDisposition in interface FrameBody.FrameBodyHandler<java.lang.Integer>public void handleDetach(Detach detach, Binary payload, java.lang.Integer channel)
handleDetach in interface FrameBody.FrameBodyHandler<java.lang.Integer>public void handleEnd(End end, Binary payload, java.lang.Integer channel)
handleEnd in interface FrameBody.FrameBodyHandler<java.lang.Integer>public void handleClose(Close close, Binary payload, java.lang.Integer channel)
handleClose in interface FrameBody.FrameBodyHandler<java.lang.Integer>public boolean handleFrame(TransportFrame frame)
handleFrame in interface FrameHandlerFrameHandler.isHandlingFrames()public void closed(TransportException error)
closed in interface FrameHandlerpublic boolean isHandlingFrames()
FrameHandlerFrameHandler.handleFrame(TransportFrame).isHandlingFrames in interface FrameHandlerpublic ProtocolTracer getProtocolTracer()
getProtocolTracer in interface ProtonJTransportpublic void setProtocolTracer(ProtocolTracer protocolTracer)
setProtocolTracer in interface ProtonJTransportpublic java.nio.ByteBuffer getInputBuffer()
TransportTransport.processInput()
must be called.
Successive calls to this method are not guaranteed to return the same object.
Once Transport.processInput() is called the buffer must not be used.getInputBuffer in interface Transportpublic TransportResult processInput()
TransportTransport.processInput() calls on this object will
throw an exception.processInput in interface TransportTransport.getInputBuffer()public java.nio.ByteBuffer getOutputBuffer()
TransportTransport.outputConsumed()
must be called.
Successive calls to this method are not guaranteed to return the same object.
Once Transport.outputConsumed() is called the buffer must not be used.
If the transport's state changes AFTER calling this method, this will not be
reflected in the output buffer.getOutputBuffer in interface Transportpublic void outputConsumed()
TransportTransport.getOutputBuffer()
is finished with, allowing implementation-dependent steps to be performed such as
reclaiming buffer space.outputConsumed in interface Transportpublic void process()
throws TransportException
process in interface TransportTransportExceptionpublic void close_tail()
close_tail in interface Transportpublic void setIdleTimeout(int timeout)
setIdleTimeout in interface Transporttimeout - local idle timeout in millisecondspublic int getIdleTimeout()
getIdleTimeout in interface Transportpublic int getRemoteIdleTimeout()
getRemoteIdleTimeout in interface Transportpublic long tick(long now)
TransportSystem.currentTimeMillis() or derived
from System.nanoTime(), noting that for the later in particular that the returned
deadline could be a different sign than the given time, and (if non-zero) the returned
deadline should have the current time originally provided subtracted from it in order to
establish a relative time delay to the next deadline.public long getFramesOutput()
getFramesOutput in interface Transportpublic long getFramesInput()
getFramesInput in interface Transportpublic void close_head()
close_head in interface Transportpublic java.lang.String toString()
toString in class java.lang.Objectpublic void setFrameHandler(FrameHandler frameHandler)
getInputBuffer(), getOutputBuffer(), ssl(SslDomain) etc).public void setSelectable(Selectable selectable)
public Selectable getSelectable()
public void setReactor(Reactor reactor)
public Reactor getReactor()
public void setEmitFlowEventOnSend(boolean emitFlowEventOnSend)
TransportsetEmitFlowEventOnSend in interface TransportemitFlowEventOnSend - true if a flow event should be emitted, false otherwisepublic boolean isEmitFlowEventOnSend()
isEmitFlowEventOnSend in interface Transportpublic void setUseReadOnlyOutputBuffer(boolean value)
setUseReadOnlyOutputBuffer in interface TransportInternalpublic boolean isUseReadOnlyOutputBuffer()
isUseReadOnlyOutputBuffer in interface TransportInternalpublic void addTransportLayer(TransportLayer layer)
TransportInternalTransportLayer to the transport, wrapping the input and output process handlers
in the state they currently exist. No effect if the given layer was previously added.addTransportLayer in interface TransportInternallayer - the layer to add (if it was not previously added)public void setOutboundFrameSizeLimit(int limit)
TransportsetOutboundFrameSizeLimit in interface Transportlimit - the size limit to applypublic int getOutboundFrameSizeLimit()
getOutboundFrameSizeLimit in interface Transport