Class ProtonConnection
java.lang.Object
org.apache.qpid.protonj2.engine.impl.ProtonEndpoint<Connection>
org.apache.qpid.protonj2.engine.impl.ProtonConnection
- All Implemented Interfaces:
- Connection,- Endpoint<Connection>,- AMQPHeader.HeaderHandler<ProtonEngine>,- Performative.PerformativeHandler<ProtonEngine>
public class ProtonConnection
extends ProtonEndpoint<Connection>
implements Connection, AMQPHeader.HeaderHandler<ProtonEngine>, Performative.PerformativeHandler<ProtonEngine>
Implements the proton Connection API
- 
Field SummaryFields inherited from class org.apache.qpid.protonj2.engine.impl.ProtonEndpointengine
- 
Method SummaryModifier and TypeMethodDescriptionclose()Close the end point locally and send the closing performative immediately if possible or holds it until the Connection / Engine state allows it.intSymbol[]longlongSymbol[]Gets the parent of thisEndpointwhich can be itself forConnectioninstance.Symbol[]longlongSymbol[]getState()voidhandleAMQPHeader(AMQPHeader header, ProtonEngine context) voidhandleAttach(Attach attach, ProtonBuffer payload, int channel, ProtonEngine context) voidhandleBegin(Begin begin, ProtonBuffer payload, int channel, ProtonEngine context) voidhandleClose(Close close, ProtonBuffer payload, int channel, ProtonEngine context) voidhandleDetach(Detach detach, ProtonBuffer payload, int channel, ProtonEngine context) voidhandleDisposition(Disposition disposition, ProtonBuffer payload, int channel, ProtonEngine context) voidhandleEnd(End end, ProtonBuffer payload, int channel, ProtonEngine context) voidhandleFlow(Flow flow, ProtonBuffer payload, int channel, ProtonEngine context) voidhandleOpen(Open open, ProtonBuffer payload, int channel, ProtonEngine context) voidhandleSASLHeader(AMQPHeader header, ProtonEngine context) voidhandleTransfer(Transfer transfer, ProtonBuffer payload, int channel, ProtonEngine context) booleanReturns true if thisEndpointis currently locally closed meaning that a call to theEndpoint.close()method has occurred.booleanReturns true if thisEndpointis currently locally open meaning that theEndpoint.open()has been called but theEndpoint.close()has not.booleanbooleanIf not already negotiated this method initiates the AMQP protocol negotiation phase of the connection process sending theAMQPHeaderto the remote peer.negotiate(EventHandler<AMQPHeader> remoteAMQPHeaderHandler) If not already negotiated this method initiates the AMQP protocol negotiation phase of the connection process sending theAMQPHeaderto the remote peer.open()Open the end point locally, sending the Open performative immediately if possible or holding it until SASL negotiations or the AMQP header exchange and other required performative exchanges has completed.receiverOpenHandler(EventHandler<Receiver> remoteReceiverOpenEventHandler) Sets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a receiving link.senderOpenHandler(EventHandler<Sender> remoteSenderOpenEventHandler) Sets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a sending link.session()Creates a new Session linked to this ConnectionsessionOpenHandler(EventHandler<Session> remoteSessionOpenEventHandler) Sets aEventHandlerfor when an AMQP Begin frame is received from the remote peer.sessions()Returns an unmodifiableSetof Sessions that are tracked by the Connection.setChannelMax(int channelMax) Set the channel max value for this Connection.setContainerId(String containerId) Sets the Container Id to be used when opening this Connection.setDesiredCapabilities(Symbol... capabilities) Sets the capabilities that are desired from the remote when thisEndpointis opened.setHostname(String hostname) Set the name of the host (either fully qualified or relative) to which this connection is connecting to.setIdleTimeout(long idleTimeout) Set the idle timeout value for this Connection.setMaxFrameSize(long maxFrameSize) Sets the maximum frame size allowed for this connection, which is the largest single frame that the remote can send to thisConnectionbefore it will close the connection with an error condition indicating the violation.setOfferedCapabilities(Symbol... capabilities) Sets the capabilities to be offered on to the remote when thisEndpointis opened.setProperties(Map<Symbol, Object> properties) Sets the properties to be sent to the remote when thisEndpointis Opened.longtick(long current) Performs a tick operation on the connection which checks that Connection Idle timeout processing is run.tickAuto(ScheduledExecutorService executor) Convenience method which is the same as callingEngine.tickAuto(ScheduledExecutorService).Convenience method which is the same as callingEngine.tickAuto(Scheduler).transactionManagerOpenHandler(EventHandler<TransactionManager> remoteTxnManagerOpenEventHandler) Sets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a transaction coordination link.Methods inherited from class org.apache.qpid.protonj2.engine.impl.ProtonEndpointcloseHandler, engineShutdownHandler, getAttachments, getCondition, getEngine, getLinkedResource, getLinkedResource, getRemoteCondition, localCloseHandler, localOpenHandler, openHandler, setCondition, setLinkedResourceMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.qpid.protonj2.engine.EndpointcloseHandler, engineShutdownHandler, getAttachments, getCondition, getEngine, getLinkedResource, getLinkedResource, getRemoteCondition, localCloseHandler, localOpenHandler, openHandler, setCondition, setLinkedResource
- 
Method Details- 
getParentDescription copied from interface:EndpointGets the parent of thisEndpointwhich can be itself forConnectioninstance.- Specified by:
- getParentin interface- Connection
- Specified by:
- getParentin interface- Endpoint<Connection>
- Returns:
- this Connectionas it is the root of theEndpointhierarchy.
 
- 
getState- Specified by:
- getStatein interface- Connection
- Returns:
- the local connection state only
 
- 
openDescription copied from interface:EndpointOpen the end point locally, sending the Open performative immediately if possible or holding it until SASL negotiations or the AMQP header exchange and other required performative exchanges has completed. The end point will signal any registered handler of the remote opening the Connection once the remote performative that signals open completion arrives.- Specified by:
- openin interface- Endpoint<Connection>
- Returns:
- this Endpointinstance.
- Throws:
- EngineStateException- if an error occurs opening the Connection or the Engine is shutdown.
 
- 
closeDescription copied from interface:EndpointClose the end point locally and send the closing performative immediately if possible or holds it until the Connection / Engine state allows it. If the engine encounters an error writing the performative or the engine is in a failed state from a previous error then this method will throw an exception. If the engine has been shutdown then this method will close out the local end of theEndpointand clean up any local resources before returning normally.- Specified by:
- closein interface- Endpoint<Connection>
- Returns:
- this Endpointinstance.
- Throws:
- EngineFailedException- if an error occurs closing the end point or the Engine is in a failed state.
 
- 
negotiateDescription copied from interface:ConnectionIf not already negotiated this method initiates the AMQP protocol negotiation phase of the connection process sending theAMQPHeaderto the remote peer. For a client application this could mean requesting the server to indicate if it supports the version of the protocol this client speaks. In rare cases a server could use this to preemptively send its AMQP header. Once a header is sent the remote should respond with the AMQP Header that indicates what protocol level it supports and if there is a mismatch the the engine will be failed with a error indicating the protocol support was not successfully negotiated. If the engine has a configured SASL layer then by starting the AMQP Header exchange this will implicitly first attempt the SASL authentication step of the connection process.- Specified by:
- negotiatein interface- Connection
- Returns:
- this Connectioninstance.
 
- 
negotiateDescription copied from interface:ConnectionIf not already negotiated this method initiates the AMQP protocol negotiation phase of the connection process sending theAMQPHeaderto the remote peer. For a client application this could mean requesting the server to indicate if it supports the version of the protocol this client speaks. In rare cases a server could use this to preemptively send its AMQP header. Once a header is sent the remote should respond with the AMQP Header that indicates what protocol level it supports and if there is a mismatch the the engine will be failed with a error indicating the protocol support was not successfully negotiated. If the engine has a configured SASL layer then by starting the AMQP Header exchange this will implicitly first attempt the SASL authentication step of the connection process. The provided remote AMQP Header handler will be called once the remote sends its AMQP Header to the either preemptively or as a response to offered AMQP Header from this peer, even if that has already happened prior to this call.- Specified by:
- negotiatein interface- Connection
- Parameters:
- remoteAMQPHeaderHandler- Handler to be called when an AMQP Header response has arrived.
- Returns:
- this Connectioninstance.
 
- 
tickpublic long tick(long current) Description copied from interface:ConnectionPerforms a tick operation on the connection which checks that Connection Idle timeout processing is run. This method is a convenience method that delegates the work to theEngine.tick(long)method. It is an error to call this method ifConnection.tickAuto(ScheduledExecutorService)was called.- Specified by:
- tickin interface- Connection
- Parameters:
- current- Current time value usually taken from- System.nanoTime()
- Returns:
- the absolute deadline in milliseconds to next call tick by/at, or 0 if there is none.
- See Also:
 
- 
tickAutoDescription copied from interface:ConnectionConvenience method which is the same as callingEngine.tickAuto(ScheduledExecutorService).- Specified by:
- tickAutoin interface- Connection
- Parameters:
- executor- The single threaded execution context where all engine work takes place.
- Returns:
- this Connectioninstance.
- See Also:
 
- 
tickAutoDescription copied from interface:ConnectionConvenience method which is the same as callingEngine.tickAuto(Scheduler).- Specified by:
- tickAutoin interface- Connection
- Parameters:
- scheduler- The single threaded execution context where all engine work takes place.
- Returns:
- this Connectioninstance.
- See Also:
 
- 
isLocallyClosedpublic boolean isLocallyClosed()Description copied from interface:EndpointReturns true if thisEndpointis currently locally closed meaning that a call to theEndpoint.close()method has occurred.- Specified by:
- isLocallyClosedin interface- Endpoint<Connection>
- Returns:
- trueif the- Endpointis locally closed.
- See Also:
 
- 
isRemotelyClosedpublic boolean isRemotelyClosed()Description copied from interface:EndpointReturns true if thisEndpointis currently remotely closed meaning that the AMQP performative that completes the close phase of thisEndpoint's lifetime has arrived.- Specified by:
- isRemotelyClosedin interface- Endpoint<Connection>
- Returns:
- trueif the- Endpointis remotely closed.
- See Also:
 
- 
setContainerIdDescription copied from interface:ConnectionSets the Container Id to be used when opening this Connection. The container Id can only be modified prior to a call toEndpoint.open(), once the connection has been opened locally an error will be thrown if this method is called.- Specified by:
- setContainerIdin interface- Connection
- Parameters:
- containerId- The Container Id used for this end of the Connection.
- Returns:
- this connection.
 
- 
getContainerId- Specified by:
- getContainerIdin interface- Connection
- Returns:
- the Container ID assigned to this Connection
 
- 
setHostnameDescription copied from interface:ConnectionSet the name of the host (either fully qualified or relative) to which this connection is connecting to. This information may be used by the remote peer to determine the correct back-end service to connect the client to. This value will be sent in the Open performative. Note that it is illegal to set the host name to a numeric IP address or include a port number. The host name value can only be modified prior to a call toEndpoint.open(), once the connection has been opened locally an error will be thrown if this method is called.- Specified by:
- setHostnamein interface- Connection
- Parameters:
- hostname- the RFC1035 compliant host name.
- Returns:
- this connection.
 
- 
getHostname- Specified by:
- getHostnamein interface- Connection
- Returns:
- returns the host name assigned to this Connection.
- See Also:
 
- 
setMaxFrameSizeDescription copied from interface:ConnectionSets the maximum frame size allowed for this connection, which is the largest single frame that the remote can send to thisConnectionbefore it will close the connection with an error condition indicating the violation. The legal range for this value is defined as (512 - 2^32-1) bytes. The max frame size value can only be modified prior to a call toEndpoint.open(), once the connection has been opened locally an error will be thrown if this method is called.- Specified by:
- setMaxFrameSizein interface- Connection
- Parameters:
- maxFrameSize- The maximum number of bytes allowed for a single
- Returns:
- this connection.
 
- 
getMaxFrameSizepublic long getMaxFrameSize()- Specified by:
- getMaxFrameSizein interface- Connection
- Returns:
- the currently configured max frame size this connection will accept.
 
- 
setChannelMaxDescription copied from interface:ConnectionSet the channel max value for this Connection. The channel max value can only be modified prior to a call toEndpoint.open(), once the connection has been opened locally an error will be thrown if this method is called.- Specified by:
- setChannelMaxin interface- Connection
- Parameters:
- channelMax- The value to set for channel max when opening the connection.
- Returns:
- this connection.
 
- 
getChannelMaxpublic int getChannelMax()- Specified by:
- getChannelMaxin interface- Connection
- Returns:
- the currently configured channel max for this Connection
 
- 
setIdleTimeoutDescription copied from interface:ConnectionSet the idle timeout value for this Connection. The idle timeout value can only be modified prior to a call toEndpoint.open(), once the connection has been opened locally an error will be thrown if this method is called.- Specified by:
- setIdleTimeoutin interface- Connection
- Parameters:
- idleTimeout- The value to set for the idle timeout when opening the connection.
- Returns:
- this connection.
 
- 
getIdleTimeoutpublic long getIdleTimeout()- Specified by:
- getIdleTimeoutin interface- Connection
- Returns:
- the currently configured idle timeout for this Connection
 
- 
setOfferedCapabilitiesDescription copied from interface:EndpointSets the capabilities to be offered on to the remote when thisEndpointis opened. The offered capabilities value can only be modified prior to a call toEndpoint.open(), once theEndpointhas been opened locally an error will be thrown if this method is called.- Specified by:
- setOfferedCapabilitiesin interface- Endpoint<Connection>
- Parameters:
- capabilities- The capabilities to be offered to the remote when the- Endpointis opened.
- Returns:
- this Endpointinstance.
 
- 
getOfferedCapabilities- Specified by:
- getOfferedCapabilitiesin interface- Endpoint<Connection>
- Returns:
- the configured capabilities that are offered to the remote when the Endpointis opened.
 
- 
setDesiredCapabilitiesDescription copied from interface:EndpointSets the capabilities that are desired from the remote when thisEndpointis opened. The desired capabilities value can only be modified prior to a call toEndpoint.open(), once theEndpointhas been opened locally an error will be thrown if this method is called.- Specified by:
- setDesiredCapabilitiesin interface- Endpoint<Connection>
- Parameters:
- capabilities- The capabilities desired from the remote when the- Endpointis opened.
- Returns:
- this Endpointinstance.
 
- 
getDesiredCapabilities- Specified by:
- getDesiredCapabilitiesin interface- Endpoint<Connection>
- Returns:
- the configured desired capabilities that are sent to the remote when the Connection is opened.
 
- 
setPropertiesDescription copied from interface:EndpointSets the properties to be sent to the remote when thisEndpointis Opened. TheEndpointproperties value can only be modified prior to a call toEndpoint.open(), once theEndpointhas been opened locally an error will be thrown if this method is called.- Specified by:
- setPropertiesin interface- Endpoint<Connection>
- Parameters:
- properties- The properties that will be sent to the remote when this Connection is opened.
- Returns:
- this Endpointinstance.
 
- 
getProperties- Specified by:
- getPropertiesin interface- Endpoint<Connection>
- Returns:
- the configured properties sent to the remote when this Connection is opened.
 
- 
isLocallyOpenpublic boolean isLocallyOpen()Description copied from interface:EndpointReturns true if thisEndpointis currently locally open meaning that theEndpoint.open()has been called but theEndpoint.close()has not.- Specified by:
- isLocallyOpenin interface- Endpoint<Connection>
- Returns:
- trueif the- Endpointis locally open.
- See Also:
 
- 
isRemotelyOpenpublic boolean isRemotelyOpen()Description copied from interface:EndpointReturns true if thisEndpointis currently remotely open meaning that the AMQP performative that completes the open phase of thisEndpoint's lifetime has arrived but the performative that closes it has not.- Specified by:
- isRemotelyOpenin interface- Endpoint<Connection>
- Returns:
- trueif the- Endpointis remotely open.
- See Also:
 
- 
getRemoteContainerId- Specified by:
- getRemoteContainerIdin interface- Connection
- Returns:
- the Container Id assigned to the remote end of the Connection.
 
- 
getRemoteHostname- Specified by:
- getRemoteHostnamein interface- Connection
- Returns:
- the host name assigned to the remote end of this Connection.
 
- 
getRemoteMaxFrameSizepublic long getRemoteMaxFrameSize()- Specified by:
- getRemoteMaxFrameSizein interface- Connection
- Returns:
- the remote set max frame size limit.
 
- 
getRemoteIdleTimeoutpublic long getRemoteIdleTimeout()- Specified by:
- getRemoteIdleTimeoutin interface- Connection
- Returns:
- the idle timeout value provided by the remote end of this Connection.
 
- 
getRemoteOfferedCapabilities- Specified by:
- getRemoteOfferedCapabilitiesin interface- Endpoint<Connection>
- Returns:
- the capabilities offered by the remote when it opened its end of the Endpoint.
 
- 
getRemoteDesiredCapabilities- Specified by:
- getRemoteDesiredCapabilitiesin interface- Endpoint<Connection>
- Returns:
- the capabilities desired by the remote when it opened its end of the Endpoint.
 
- 
getRemoteProperties- Specified by:
- getRemotePropertiesin interface- Endpoint<Connection>
- Returns:
- the properties sent by the remote when it opened its end of the Endpoint.
 
- 
getRemoteState- Specified by:
- getRemoteStatein interface- Connection
- Returns:
- the remote state (as last communicated)
 
- 
sessionDescription copied from interface:ConnectionCreates a new Session linked to this Connection- Specified by:
- sessionin interface- Connection
- Returns:
- a newly created Sessionlinked to thisConnection.
- Throws:
- IllegalStateException- if the- Connectionhas already been closed.
 
- 
sessionsDescription copied from interface:ConnectionReturns an unmodifiableSetof Sessions that are tracked by the Connection. TheSessioninstances returned from this method will be locally or remotely open or both which gives the caller full view of the complete set of knownSessioninstances.- Specified by:
- sessionsin interface- Connection
- Returns:
- an unmodifiable Setof Sessions tracked by this Connection.
- Throws:
- IllegalStateException
 
- 
handleAMQPHeader- Specified by:
- handleAMQPHeaderin interface- AMQPHeader.HeaderHandler<ProtonEngine>
 
- 
handleSASLHeader- Specified by:
- handleSASLHeaderin interface- AMQPHeader.HeaderHandler<ProtonEngine>
 
- 
handleOpen- Specified by:
- handleOpenin interface- Performative.PerformativeHandler<ProtonEngine>
 
- 
handleClose- Specified by:
- handleClosein interface- Performative.PerformativeHandler<ProtonEngine>
 
- 
handleBegin- Specified by:
- handleBeginin interface- Performative.PerformativeHandler<ProtonEngine>
 
- 
handleEnd- Specified by:
- handleEndin interface- Performative.PerformativeHandler<ProtonEngine>
 
- 
handleAttach- Specified by:
- handleAttachin interface- Performative.PerformativeHandler<ProtonEngine>
 
- 
handleDetach- Specified by:
- handleDetachin interface- Performative.PerformativeHandler<ProtonEngine>
 
- 
handleFlow- Specified by:
- handleFlowin interface- Performative.PerformativeHandler<ProtonEngine>
 
- 
handleTransferpublic void handleTransfer(Transfer transfer, ProtonBuffer payload, int channel, ProtonEngine context) - Specified by:
- handleTransferin interface- Performative.PerformativeHandler<ProtonEngine>
 
- 
handleDispositionpublic void handleDisposition(Disposition disposition, ProtonBuffer payload, int channel, ProtonEngine context) - Specified by:
- handleDispositionin interface- Performative.PerformativeHandler<ProtonEngine>
 
- 
sessionOpenHandlerDescription copied from interface:ConnectionSets aEventHandlerfor when an AMQP Begin frame is received from the remote peer. Used to process remotely initiated Sessions. Locally initiated sessions have their own EventHandler invoked instead. This method is Typically used by servers to listen for remote Session creation.- Specified by:
- sessionOpenHandlerin interface- Connection
- Parameters:
- remoteSessionOpenEventHandler- the EventHandler that will be signaled when a session is remotely opened.
- Returns:
- this connection
 
- 
senderOpenHandlerDescription copied from interface:ConnectionSets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a sending link. Used to process remotely initiated sending link. Locally initiated links have their own EventHandler invoked instead. This method is Typically used by servers to listen for remote Receiver creation. If an event handler for remote sender open is registered on the Session that the link is owned by then that handler will be invoked instead of this one.- Specified by:
- senderOpenHandlerin interface- Connection
- Parameters:
- remoteSenderOpenEventHandler- the EventHandler that will be signaled when a sender link is remotely opened.
- Returns:
- this connection
 
- 
receiverOpenHandlerDescription copied from interface:ConnectionSets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a receiving link. Used to process remotely initiated receiving link. Locally initiated links have their own EventHandler invoked instead. This method is Typically used by servers to listen for remote Sender creation. If an event handler for remote receiver open is registered on the Session that the link is owned by then that handler will be invoked instead of this one.- Specified by:
- receiverOpenHandlerin interface- Connection
- Parameters:
- remoteReceiverOpenEventHandler- the EventHandler that will be signaled when a receiver link is remotely opened.
- Returns:
- this connection
 
- 
transactionManagerOpenHandlerpublic ProtonConnection transactionManagerOpenHandler(EventHandler<TransactionManager> remoteTxnManagerOpenEventHandler) Description copied from interface:ConnectionSets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a transaction coordination link. Used to process remotely initiated transaction manager link. Locally initiated links have their own EventHandler invoked instead. This method is Typically used by servers to listen for remoteTransactionControllercreation. If an event handler for remoteTransactionControlleropen is registered on the Session that the link is owned by then that handler will be invoked instead of this one.- Specified by:
- transactionManagerOpenHandlerin interface- Connection
- Parameters:
- remoteTxnManagerOpenEventHandler- the EventHandler that will be signaled when a- TransactionControllerlink is remotely opened.
- Returns:
- this connection
 
 
-