Package org.apache.qpid.protonj2.engine
Interface Connection
- 
- All Superinterfaces:
- Endpoint<Connection>
 - All Known Implementing Classes:
- ProtonConnection
 
 public interface Connection extends Endpoint<Connection> AMQP Connection state container
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetChannelMax()java.lang.StringgetContainerId()java.lang.StringgetHostname()longgetIdleTimeout()longgetMaxFrameSize()ConnectiongetParent()Gets the parent of thisEndpointwhich can be itself forConnectioninstance.java.lang.StringgetRemoteContainerId()java.lang.StringgetRemoteHostname()longgetRemoteIdleTimeout()longgetRemoteMaxFrameSize()ConnectionStategetRemoteState()ConnectionStategetState()Connectionnegotiate()If not already negotiated this method initiates the AMQP protocol negotiation phase of the connection process sending theAMQPHeaderto the remote peer.Connectionnegotiate(EventHandler<AMQPHeader> remoteAMQPHeaderHandler)If not already negotiated this method initiates the AMQP protocol negotiation phase of the connection process sending theAMQPHeaderto the remote peer.ConnectionreceiverOpenHandler(EventHandler<Receiver> remoteReceiverOpenEventHandler)Sets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a receiving link.ConnectionsenderOpenHandler(EventHandler<Sender> remoteSenderOpenEventHandler)Sets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a sending link.Sessionsession()Creates a new Session linked to this ConnectionConnectionsessionOpenHandler(EventHandler<Session> remoteSessionOpenEventHandler)Sets aEventHandlerfor when an AMQP Begin frame is received from the remote peer.java.util.Set<Session>sessions()Returns an unmodifiableSetof Sessions that are tracked by the Connection.ConnectionsetChannelMax(int channelMax)Set the channel max value for this Connection.ConnectionsetContainerId(java.lang.String containerId)Sets the Container Id to be used when opening this Connection.ConnectionsetHostname(java.lang.String hostname)Set the name of the host (either fully qualified or relative) to which this connection is connecting to.ConnectionsetIdleTimeout(long idleTimeout)Set the idle timeout value for this Connection.ConnectionsetMaxFrameSize(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.longtick(long current)Performs a tick operation on the connection which checks that Connection Idle timeout processing is run.ConnectiontickAuto(java.util.concurrent.ScheduledExecutorService executor)Convenience method which is the same as callingEngine.tickAuto(ScheduledExecutorService).ConnectiontransactionManagerOpenHandler(EventHandler<TransactionManager> remoteTxnManagerOpenEventHandler)Sets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a transaction coordination link.- 
Methods inherited from interface org.apache.qpid.protonj2.engine.Endpointclose, closeHandler, engineShutdownHandler, getAttachments, getCondition, getDesiredCapabilities, getEngine, getLinkedResource, getLinkedResource, getOfferedCapabilities, getProperties, getRemoteCondition, getRemoteDesiredCapabilities, getRemoteOfferedCapabilities, getRemoteProperties, isLocallyClosed, isLocallyOpen, isRemotelyClosed, isRemotelyOpen, localCloseHandler, localOpenHandler, open, openHandler, setCondition, setDesiredCapabilities, setLinkedResource, setOfferedCapabilities, setProperties
 
- 
 
- 
- 
- 
Method Detail- 
negotiateConnection negotiate() throws EngineStateException If 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.- Returns:
- this Connectioninstance.
- Throws:
- EngineStateException- if the Engine state precludes accepting new input.
 
 - 
negotiateConnection negotiate(EventHandler<AMQPHeader> remoteAMQPHeaderHandler) throws EngineStateException If 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.- Parameters:
- remoteAMQPHeaderHandler- Handler to be called when an AMQP Header response has arrived.
- Returns:
- this Connectioninstance.
- Throws:
- EngineStateException- if the Engine state precludes accepting new input.
 
 - 
ticklong tick(long current) throws java.lang.IllegalStateException, EngineStateExceptionPerforms 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 iftickAuto(ScheduledExecutorService)was called.- 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.
- Throws:
- java.lang.IllegalStateException- if the- Engineis already performing auto tick handling.
- EngineStateException- if the Engine state precludes accepting new input.
- See Also:
- Engine.tick(long)
 
 - 
tickAutoConnection tickAuto(java.util.concurrent.ScheduledExecutorService executor) Convenience method which is the same as callingEngine.tickAuto(ScheduledExecutorService).- Parameters:
- executor- The single threaded execution context where all engine work takes place.
- Returns:
- this Connectioninstance.
- Throws:
- java.lang.IllegalStateException- if the- Engineis already performing auto tick handling.
- EngineStateException- if the Engine state precludes accepting new input.
- See Also:
- Engine.tickAuto(ScheduledExecutorService)
 
 - 
getStateConnectionState getState() - Returns:
- the local connection state only
 
 - 
getParentConnection getParent() Description copied from interface:EndpointGets the parent of thisEndpointwhich can be itself forConnectioninstance.- Specified by:
- getParentin interface- Endpoint<Connection>
- Returns:
- this Connectionas it is the root of theEndpointhierarchy.
 
 - 
getContainerIdjava.lang.String getContainerId() - Returns:
- the Container ID assigned to this Connection
 
 - 
setContainerIdConnection setContainerId(java.lang.String containerId) throws java.lang.IllegalStateException Sets 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.- Parameters:
- containerId- The Container Id used for this end of the Connection.
- Returns:
- this connection.
- Throws:
- java.lang.IllegalStateException- if the Connection has already been opened.
 
 - 
setHostnameConnection setHostname(java.lang.String hostname) throws java.lang.IllegalStateException Set 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.- Parameters:
- hostname- the RFC1035 compliant host name.
- Returns:
- this connection.
- Throws:
- java.lang.IllegalStateException- if the Connection has already been opened.
 
 - 
getHostnamejava.lang.String getHostname() - Returns:
- returns the host name assigned to this Connection.
- See Also:
- setHostname(java.lang.String)
 
 - 
setChannelMaxConnection setChannelMax(int channelMax) throws java.lang.IllegalStateException Set 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.- Parameters:
- channelMax- The value to set for channel max when opening the connection.
- Returns:
- this connection.
- Throws:
- java.lang.IllegalStateException- if the Connection has already been opened.
 
 - 
getChannelMaxint getChannelMax() - Returns:
- the currently configured channel max for this Connection
 
 - 
setMaxFrameSizeConnection setMaxFrameSize(long maxFrameSize) throws java.lang.IllegalStateException 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. 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.- Parameters:
- maxFrameSize- The maximum number of bytes allowed for a single
- Returns:
- this connection.
- Throws:
- java.lang.IllegalStateException- if the Connection has already been opened.
 
 - 
getMaxFrameSizelong getMaxFrameSize() - Returns:
- the currently configured max frame size this connection will accept.
 
 - 
setIdleTimeoutConnection setIdleTimeout(long idleTimeout) throws java.lang.IllegalStateException Set 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.- Parameters:
- idleTimeout- The value to set for the idle timeout when opening the connection.
- Returns:
- this connection.
- Throws:
- java.lang.IllegalStateException- if the Connection has already been opened.
 
 - 
getIdleTimeoutlong getIdleTimeout() - Returns:
- the currently configured idle timeout for this Connection
 
 - 
sessionSession session() throws java.lang.IllegalStateException Creates a new Session linked to this Connection- Returns:
- a newly created Sessionlinked to thisConnection.
- Throws:
- java.lang.IllegalStateException- if the- Connectionhas already been closed.
 
 - 
sessionsjava.util.Set<Session> sessions() Returns 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.- Returns:
- an unmodifiable Setof Sessions tracked by this Connection.
 
 - 
getRemoteContainerIdjava.lang.String getRemoteContainerId() - Returns:
- the Container Id assigned to the remote end of the Connection.
 
 - 
getRemoteHostnamejava.lang.String getRemoteHostname() - Returns:
- the host name assigned to the remote end of this Connection.
 
 - 
getRemoteIdleTimeoutlong getRemoteIdleTimeout() - Returns:
- the idle timeout value provided by the remote end of this Connection.
 
 - 
getRemoteMaxFrameSizelong getRemoteMaxFrameSize() - Returns:
- the remote set max frame size limit.
 
 - 
getRemoteStateConnectionState getRemoteState() - Returns:
- the remote state (as last communicated)
 
 - 
sessionOpenHandlerConnection sessionOpenHandler(EventHandler<Session> remoteSessionOpenEventHandler) Sets 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.- Parameters:
- remoteSessionOpenEventHandler- the EventHandler that will be signaled when a session is remotely opened.
- Returns:
- this connection
 
 - 
senderOpenHandlerConnection senderOpenHandler(EventHandler<Sender> remoteSenderOpenEventHandler) Sets 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.- Parameters:
- remoteSenderOpenEventHandler- the EventHandler that will be signaled when a sender link is remotely opened.
- Returns:
- this connection
 
 - 
receiverOpenHandlerConnection receiverOpenHandler(EventHandler<Receiver> remoteReceiverOpenEventHandler) Sets 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.- Parameters:
- remoteReceiverOpenEventHandler- the EventHandler that will be signaled when a receiver link is remotely opened.
- Returns:
- this connection
 
 - 
transactionManagerOpenHandlerConnection transactionManagerOpenHandler(EventHandler<TransactionManager> remoteTxnManagerOpenEventHandler) Sets 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.- Parameters:
- remoteTxnManagerOpenEventHandler- the EventHandler that will be signaled when a- TransactionControllerlink is remotely opened.
- Returns:
- this connection
 
 
- 
 
-