Class ProtonSession
java.lang.Object
org.apache.qpid.protonj2.engine.impl.ProtonEndpoint<Session>
org.apache.qpid.protonj2.engine.impl.ProtonSession
Proton API for Session type.
- 
Field SummaryFields inherited from class org.apache.qpid.protonj2.engine.impl.ProtonEndpointengine
- 
Constructor SummaryConstructorsConstructorDescriptionProtonSession(ProtonConnection connection, int localChannel) Creates a newProtonSessioninstance bound to the givenProtonConnection.
- 
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.coordinator(String name) Create a newTransactionControllerusing the provided name.deliveryReadHandler(EventHandler<IncomingDelivery> deliveryReadHandler) Allows monitoring of incoming deliveries to receivers attached to thisSession.Symbol[]longintintSymbol[]intGets the parent of thisEndpointwhich can be itself forConnectioninstance.intintintSymbol[]Symbol[]getState()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.booleanbooleanlinks()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.Create a newReceiverlink using the provided namereceiverOpenHandler(EventHandler<Receiver> remoteReceiverOpenEventHandler) Sets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a receiving link.Create a newSenderlink using the provided name.senderOpenHandler(EventHandler<Sender> remoteSenderOpenEventHandler) Sets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a sending link.senders()setDesiredCapabilities(Symbol... capabilities) Sets the capabilities that are desired from the remote when thisEndpointis opened.setHandleMax(long handleMax) Set the handle max value for this Session.setIncomingCapacity(int incomingCapacity) Sets the maximum number of bytes this session can be sent from the remote.setOfferedCapabilities(Symbol... capabilities) Sets the capabilities to be offered on to the remote when thisEndpointis opened.setOutgoingCapacity(int outgoingCapacity) Sets the maximum number of bytes this session can be write before blocking additional sends until the written bytes are known to have been flushed to the write.setProperties(Map<Symbol, Object> properties) Sets the properties to be sent to the remote when thisEndpointis Opened.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
- 
Constructor Details- 
ProtonSessionCreates a newProtonSessioninstance bound to the givenProtonConnection.- Parameters:
- connection- The connection that is the parent of the session instance.
- localChannel- The local channel onto which this session is bound.
 
 
- 
- 
Method Details- 
getConnection- Specified by:
- getConnectionin interface- Session
- Returns:
- the parent Connectionfor this Session.
 
- 
getParentDescription copied from interface:EndpointGets the parent of thisEndpointwhich can be itself forConnectioninstance.
- 
getLocalChannelpublic int getLocalChannel()- Returns:
- the local channel onto which this Sessionis bound.
 
- 
getRemoteChannelpublic int getRemoteChannel()- Returns:
- the remote channel onto which this Sessionis bound or -1 if not yet remotely opened.
 
- 
getState
- 
getRemoteState- Specified by:
- getRemoteStatein interface- Session
- Returns:
- the remote session state (as last communicated)
 
- 
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<Session>
- Returns:
- this Endpointinstance.
- Throws:
- EngineStateException- if an error occurs opening the Connection or the Engine is shutdown.
- IllegalStateException
 
- 
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<Session>
- Returns:
- this Endpointinstance.
- Throws:
- EngineFailedException- if an error occurs closing the end point or the Engine is in a failed state.
 
- 
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<Session>
- Returns:
- trueif the- Endpointis locally open.
- 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<Session>
- Returns:
- trueif the- Endpointis locally closed.
- See Also:
 
- 
setIncomingCapacityDescription copied from interface:SessionSets the maximum number of bytes this session can be sent from the remote.- Specified by:
- setIncomingCapacityin interface- Session
- Parameters:
- incomingCapacity- maximum number of incoming bytes this session will allow
- Returns:
- this Sessioninstance.
 
- 
getIncomingCapacitypublic int getIncomingCapacity()- Specified by:
- getIncomingCapacityin interface- Session
- Returns:
- the current incoming capacity of this session.
 
- 
getRemainingIncomingCapacitypublic int getRemainingIncomingCapacity()- Specified by:
- getRemainingIncomingCapacityin interface- Session
- Returns:
- the remaining session capacity based on how many bytes are currently pending,
 
- 
setOutgoingCapacityDescription copied from interface:SessionSets the maximum number of bytes this session can be write before blocking additional sends until the written bytes are known to have been flushed to the write. This limit is intended to deal with issues of memory allocation when the I/O layer allows for asynchronous writes and finer grained control over the pending write buffers is needed.- Specified by:
- setOutgoingCapacityin interface- Session
- Parameters:
- outgoingCapacity- maximum number of outgoing bytes this session will allow before stopping senders from sending.
- Returns:
- this Sessioninstance.
 
- 
getOutgoingCapacitypublic int getOutgoingCapacity()- Specified by:
- getOutgoingCapacityin interface- Session
- Returns:
- the current outgoing capacity limit of this session.
 
- 
getRemainingOutgoingCapacitypublic int getRemainingOutgoingCapacity()- Specified by:
- getRemainingOutgoingCapacityin interface- Session
- Returns:
- the remaining session outgoing capacity based on how many bytes are currently pending,
 
- 
setHandleMaxDescription copied from interface:SessionSet the handle max value for this Session. The handle max value can only be modified prior to a call toEndpoint.open(), once the session has been opened locally an error will be thrown if this method is called.- Specified by:
- setHandleMaxin interface- Session
- Parameters:
- handleMax- The value to set for handle max when opening the session.
- Returns:
- this Sessioninstance.
- Throws:
- IllegalStateException- if the Session has already been opened.
 
- 
getHandleMaxpublic long getHandleMax()- Specified by:
- getHandleMaxin interface- Session
- Returns:
- the currently configured handle max for this Session
 
- 
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<Session>
- 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<Session>
- Returns:
- the configured properties sent to the remote when this Connection is opened.
 
- 
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<Session>
- Parameters:
- capabilities- The capabilities to be offered to the remote when the- Endpointis opened.
- Returns:
- this Endpointinstance.
 
- 
getOfferedCapabilities- Specified by:
- getOfferedCapabilitiesin interface- Endpoint<Session>
- 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<Session>
- Parameters:
- capabilities- The capabilities desired from the remote when the- Endpointis opened.
- Returns:
- this Endpointinstance.
 
- 
getDesiredCapabilities- Specified by:
- getDesiredCapabilitiesin interface- Endpoint<Session>
- Returns:
- the configured desired capabilities that are sent to the remote when the Connection is opened.
 
- 
linksDescription copied from interface:Session
- 
sendersDescription copied from interface:Session
- 
receiversDescription copied from interface:Session
- 
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<Session>
- Returns:
- trueif the- Endpointis remotely open.
- 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<Session>
- Returns:
- trueif the- Endpointis remotely closed.
- See Also:
 
- 
getRemoteOfferedCapabilities- Specified by:
- getRemoteOfferedCapabilitiesin interface- Endpoint<Session>
- Returns:
- the capabilities offered by the remote when it opened its end of the Endpoint.
 
- 
getRemoteDesiredCapabilities- Specified by:
- getRemoteDesiredCapabilitiesin interface- Endpoint<Session>
- Returns:
- the capabilities desired by the remote when it opened its end of the Endpoint.
 
- 
getRemoteProperties- Specified by:
- getRemotePropertiesin interface- Endpoint<Session>
- Returns:
- the properties sent by the remote when it opened its end of the Endpoint.
 
- 
senderDescription copied from interface:SessionCreate a newSenderlink using the provided name.
- 
receiverDescription copied from interface:SessionCreate a newReceiverlink using the provided name
- 
coordinatorDescription copied from interface:SessionCreate a newTransactionControllerusing the provided name.- Specified by:
- coordinatorin interface- Session
- Parameters:
- name- The name to assign to the created- TransactionController
- Returns:
- a newly created TransactionControllerinstance.
- Throws:
- IllegalStateException- if the- Sessionhas already been closed.
 
- 
senderOpenHandlerDescription copied from interface:SessionSets 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 this Session for a link scoped to it then this handler will be invoked instead of the variant in the Connection API.- Specified by:
- senderOpenHandlerin interface- Session
- Parameters:
- remoteSenderOpenEventHandler- the EventHandler that will be signaled when a sender link is remotely opened.
- Returns:
- this session for chaining
 
- 
receiverOpenHandlerDescription copied from interface:SessionSets 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 sender open is registered on this Session for a link scoped to it then this handler will be invoked instead of the variant in the Connection API.- Specified by:
- receiverOpenHandlerin interface- Session
- Parameters:
- remoteReceiverOpenEventHandler- the EventHandler that will be signaled when a receiver link is remotely opened.
- Returns:
- this session for chaining
 
- 
transactionManagerOpenHandlerpublic ProtonSession transactionManagerOpenHandler(EventHandler<TransactionManager> remoteTxnManagerOpenEventHandler) Description copied from interface:SessionSets 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 this Session for aTransactionControllerscoped to it then this handler will be invoked instead of the variant in theConnectionAPI.- Specified by:
- transactionManagerOpenHandlerin interface- Session
- Parameters:
- remoteTxnManagerOpenEventHandler- the EventHandler that will be signaled when a- TransactionControllerlink is remotely opened.
- Returns:
- this Session for chaining
 
- 
deliveryReadHandlerDescription copied from interface:SessionAllows monitoring of incoming deliveries to receivers attached to thisSession. TheReceiverthat is the target of the incoming delivery will be notified first of the incoming delivery and any processing should be done using theReceiver.deliveryReadHandler(EventHandler). This event point will be trigger only after theReceiverlevel handler and should be used to monitor deliveries passing through a session for logging or other state related actions performed by the service managing this session.- Specified by:
- deliveryReadHandlerin interface- Session
- Parameters:
- deliveryReadHandler- The delivery that was read which contains
- Returns:
- this Session for chaining
 
 
-