Class ProtonTransactionManager
java.lang.Object
org.apache.qpid.protonj2.engine.impl.ProtonEndpoint<TransactionManager>
org.apache.qpid.protonj2.engine.impl.ProtonTransactionManager
- All Implemented Interfaces:
- Endpoint<TransactionManager>,- TransactionManager
public final class ProtonTransactionManager
extends ProtonEndpoint<TransactionManager>
implements TransactionManager
TransactionManager implementation that implements the abstraction
 around a receiver link that responds to requests to Declare and to
 Discharge AMQP Transaction instance.- 
Field SummaryFields inherited from class org.apache.qpid.protonj2.engine.impl.ProtonEndpointengine
- 
Constructor SummaryConstructorsConstructorDescriptionProtonTransactionManager(ProtonReceiver receiverLink) Creates a newTransactionManagerinstance that wraps the givenReceiverlink.
- 
Method SummaryModifier and TypeMethodDescriptionaddCredit(int additional) Adds the given amount of credit for theTransactionManagerwhich allows theTransactionControllerto sendDeclareandDischargerequests to this manager.close()Close the end point locally and send the closing performative immediately if possible or holds it until the Connection / Engine state allows it.declared(Transaction<TransactionManager> transaction, Binary txnId) Respond to a previousDeclarerequest from the remoteTransactionControllerindicating that the requested transaction has been successfully declared and that deliveries can now be enlisted in that transaction.declareFailed(Transaction<TransactionManager> transaction, ErrorCondition condition) Respond to a previousDeclarerequest from the remoteTransactionControllerindicating that the requested transaction declaration has failed and is not active.declareHandler(EventHandler<Transaction<TransactionManager>> declaredEventHandler) Called when theTransactionControllerend of the link has requested a new transaction be declared using the information provided in the givenDeclareinstance.discharged(Transaction<TransactionManager> transaction) Respond to a previousDischargerequest from the remoteTransactionControllerindicating that the discharge completed on the transaction identified by given transaction Id has now been retired.dischargeFailed(Transaction<TransactionManager> transaction, ErrorCondition condition) Respond to a previousDischargerequest from the remoteTransactionControllerindicating that the discharge resulted in an error and the transaction must be considered rolled back.dischargeHandler(EventHandler<Transaction<TransactionManager>> dischargeEventHandler) Called when theTransactionControllerend of the link has requested a current transaction be discharged using the information provided in the givenDischargeinstance.Returns the currently set Coordinator target for thisLink.intGet the credit that is currently available or assigned to thisTransactionManager.Symbol[]Symbol[]Gets the parent of thisEndpointwhich can be itself forConnectioninstance.If the remote has closed thisEndpointand provided anErrorConditionas part of the closing AMQP performative then this method will return it.Returns the remote targetTerminusfor this transaction manager which must be of typeCoordinatoror null if remote did not set a terminus.Symbol[]Symbol[]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.booleanbooleanopen()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.Sets aEventHandlerfor when the parentSessionorConnectionof thisTransactionManageris locally closed.setCondition(ErrorCondition condition) Sets the localErrorConditionto be applied to aEndpointclose.setCoordinator(Coordinator coordinator) Sets theCoordinatortarget to assign to the local end of thisTransactionManager.setDesiredCapabilities(Symbol... desiredCapabilities) Sets the capabilities that are desired from the remote when thisEndpointis opened.setOfferedCapabilities(Symbol... offeredCapabilities) 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.Sets theSourceto assign to the local end of thisTransactionManager.Methods inherited from class org.apache.qpid.protonj2.engine.impl.ProtonEndpointcloseHandler, engineShutdownHandler, getAttachments, getEngine, getLinkedResource, getLinkedResource, localCloseHandler, localOpenHandler, openHandler, 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, getEngine, getLinkedResource, getLinkedResource, localCloseHandler, localOpenHandler, openHandler, setLinkedResourceMethods inherited from interface org.apache.qpid.protonj2.engine.TransactionManagerdeclared
- 
Constructor Details- 
ProtonTransactionManagerCreates a newTransactionManagerinstance that wraps the givenReceiverlink.- Parameters:
- receiverLink- The- Receiverlink that this- TransactionManagerwraps.
 
 
- 
- 
Method Details- 
getParentDescription copied from interface:EndpointGets the parent of thisEndpointwhich can be itself forConnectioninstance.- Specified by:
- getParentin interface- Endpoint<TransactionManager>
- Returns:
- the parent of this Endpointor itself if this is aConnection;
 
- 
addCreditDescription copied from interface:TransactionManagerAdds the given amount of credit for theTransactionManagerwhich allows theTransactionControllerto sendDeclareandDischargerequests to this manager. TheTransactionControllercannot send any requests to start or complete a transaction without having credit to do so which implies that theTransactionManagerowner must grant credit as part of its normal processing.- Specified by:
- addCreditin interface- TransactionManager
- Parameters:
- additional- the new amount of credits to add.
- Returns:
- this TransactionManager
 
- 
getCreditpublic int getCredit()Description copied from interface:TransactionManagerGet the credit that is currently available or assigned to thisTransactionManager.- Specified by:
- getCreditin interface- TransactionManager
- Returns:
- the current unused credit.
 
- 
declaredDescription copied from interface:TransactionManagerRespond to a previousDeclarerequest from the remoteTransactionControllerindicating that the requested transaction has been successfully declared and that deliveries can now be enlisted in that transaction.- Specified by:
- declaredin interface- TransactionManager
- Parameters:
- transaction- The transaction instance that is associated with the declared transaction.
- txnId- The binary transaction Id to assign the now declared transaction instance.
- Returns:
- this TransactionManager.
 
- 
dischargedDescription copied from interface:TransactionManagerRespond to a previousDischargerequest from the remoteTransactionControllerindicating that the discharge completed on the transaction identified by given transaction Id has now been retired.- Specified by:
- dischargedin interface- TransactionManager
- Parameters:
- transaction- The- Transactioninstance that has been discharged and is now retired.
- Returns:
- this TransactionManager.
 
- 
declareFailedpublic TransactionManager declareFailed(Transaction<TransactionManager> transaction, ErrorCondition condition) Description copied from interface:TransactionManagerRespond to a previousDeclarerequest from the remoteTransactionControllerindicating that the requested transaction declaration has failed and is not active.- Specified by:
- declareFailedin interface- TransactionManager
- Parameters:
- transaction- The transaction instance that is associated with the declared transaction.
- condition- The- ErrorConditionthat described the reason for the transaction failure.
- Returns:
- this TransactionManager.
 
- 
dischargeFailedpublic TransactionManager dischargeFailed(Transaction<TransactionManager> transaction, ErrorCondition condition) Description copied from interface:TransactionManagerRespond to a previousDischargerequest from the remoteTransactionControllerindicating that the discharge resulted in an error and the transaction must be considered rolled back.- Specified by:
- dischargeFailedin interface- TransactionManager
- Parameters:
- transaction- The- Transactioninstance that has been discharged and is now retired.
- condition- The- ErrorConditionthat described the reason for the transaction failure.
- Returns:
- this TransactionManager.
 
- 
declareHandlerpublic TransactionManager declareHandler(EventHandler<Transaction<TransactionManager>> declaredEventHandler) Description copied from interface:TransactionManagerCalled when theTransactionControllerend of the link has requested a new transaction be declared using the information provided in the givenDeclareinstance.- Specified by:
- declareHandlerin interface- TransactionManager
- Parameters:
- declaredEventHandler- handler that will act on the transaction declaration request.
- Returns:
- this TransactionManager.
 
- 
dischargeHandlerpublic TransactionManager dischargeHandler(EventHandler<Transaction<TransactionManager>> dischargeEventHandler) Description copied from interface:TransactionManagerCalled when theTransactionControllerend of the link has requested a current transaction be discharged using the information provided in the givenDischargeinstance.- Specified by:
- dischargeHandlerin interface- TransactionManager
- Parameters:
- dischargeEventHandler- handler that will act on the transaction declaration request.
- Returns:
- this TransactionManager.
 
- 
parentEndpointClosedHandlerDescription copied from interface:TransactionManagerSets aEventHandlerfor when the parentSessionorConnectionof thisTransactionManageris locally closed. Typically used by clients for logging or other state update event processing. Clients should not perform any blocking calls within this context. It is an error for the handler to throw an exception and the outcome of doing so is undefined.- Specified by:
- parentEndpointClosedHandlerin interface- TransactionManager
- Parameters:
- handler- The- EventHandlerto notify when this transaction manger's parent endpoint is locally closed.
- Returns:
- the link for chaining.
 
- 
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<TransactionManager>
- 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<TransactionManager>
- 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<TransactionManager>
- 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<TransactionManager>
- Returns:
- trueif the- Endpointis locally closed.
- See Also:
 
- 
setSourceDescription copied from interface:TransactionManagerSets theSourceto assign to the local end of thisTransactionManager. Must be called during setup, i.e. before calling theEndpoint.open()method.- Specified by:
- setSourcein interface- TransactionManager
- Parameters:
- source- The- Sourcethat will be set on the local end of this transaction controller.
- Returns:
- this transaction controller instance.
- Throws:
- IllegalStateException- if the- TransactionManagerhas already been opened.
 
- 
getSource- Specified by:
- getSourcein interface- TransactionManager
- Returns:
- the Sourcefor the local end of thisTransactionController.
 
- 
setCoordinatorDescription copied from interface:TransactionManagerSets theCoordinatortarget to assign to the local end of thisTransactionManager. Must be called during setup, i.e. before calling theEndpoint.open()method.- Specified by:
- setCoordinatorin interface- TransactionManager
- Parameters:
- coordinator- The- Coordinatortarget that will be set on the local end of this transaction controller.
- Returns:
- this transaction controller instance.
- Throws:
- IllegalStateException- if the- TransactionManagerhas already been opened.
 
- 
getCoordinatorDescription copied from interface:TransactionManagerReturns the currently set Coordinator target for thisLink.- Specified by:
- getCoordinatorin interface- TransactionManager
- Returns:
- the link target Coordinatorfor the local end of this link.
 
- 
getCondition- Specified by:
- getConditionin interface- Endpoint<TransactionManager>
- Overrides:
- getConditionin class- ProtonEndpoint<TransactionManager>
- Returns:
- the local Endpointerror, or null if there is none
 
- 
setConditionDescription copied from interface:EndpointSets the localErrorConditionto be applied to aEndpointclose.- Specified by:
- setConditionin interface- Endpoint<TransactionManager>
- Overrides:
- setConditionin class- ProtonEndpoint<TransactionManager>
- Parameters:
- condition- The error condition to convey to the remote peer on close of this end point.
- Returns:
- this Endpointinstance.
 
- 
getProperties- Specified by:
- getPropertiesin interface- Endpoint<TransactionManager>
- Returns:
- the configured properties sent to the remote when this 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<TransactionManager>
- Parameters:
- properties- The properties that will be sent to the remote when this Connection is opened.
- Returns:
- this Endpointinstance.
- Throws:
- IllegalStateException- if the- Endpointhas already been opened.
 
- 
setOfferedCapabilitiespublic TransactionManager setOfferedCapabilities(Symbol... offeredCapabilities) throws IllegalStateException Description 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<TransactionManager>
- Parameters:
- offeredCapabilities- The capabilities to be offered to the remote when the- Endpointis opened.
- Returns:
- this Endpointinstance.
- Throws:
- IllegalStateException- if the- Endpointhas already been opened.
 
- 
getOfferedCapabilities- Specified by:
- getOfferedCapabilitiesin interface- Endpoint<TransactionManager>
- Returns:
- the configured capabilities that are offered to the remote when the Endpointis opened.
 
- 
setDesiredCapabilitiespublic TransactionManager setDesiredCapabilities(Symbol... desiredCapabilities) throws IllegalStateException Description 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<TransactionManager>
- Parameters:
- desiredCapabilities- The capabilities desired from the remote when the- Endpointis opened.
- Returns:
- this Endpointinstance.
- Throws:
- IllegalStateException- if the- Endpointhas already been opened.
 
- 
getDesiredCapabilities- Specified by:
- getDesiredCapabilitiesin interface- Endpoint<TransactionManager>
- Returns:
- the configured desired capabilities that are sent to the remote when the Connection is opened.
 
- 
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<TransactionManager>
- 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<TransactionManager>
- Returns:
- trueif the- Endpointis remotely closed.
- See Also:
 
- 
getRemoteOfferedCapabilities- Specified by:
- getRemoteOfferedCapabilitiesin interface- Endpoint<TransactionManager>
- Returns:
- the capabilities offered by the remote when it opened its end of the Endpoint.
 
- 
getRemoteDesiredCapabilities- Specified by:
- getRemoteDesiredCapabilitiesin interface- Endpoint<TransactionManager>
- Returns:
- the capabilities desired by the remote when it opened its end of the Endpoint.
 
- 
getRemoteProperties- Specified by:
- getRemotePropertiesin interface- Endpoint<TransactionManager>
- Returns:
- the properties sent by the remote when it opened its end of the Endpoint.
 
- 
getRemoteConditionDescription copied from interface:EndpointIf the remote has closed thisEndpointand provided anErrorConditionas part of the closing AMQP performative then this method will return it.- Specified by:
- getRemoteConditionin interface- Endpoint<TransactionManager>
- Overrides:
- getRemoteConditionin class- ProtonEndpoint<TransactionManager>
- Returns:
- the remote supplied ErrorCondition, or null if there is none.
 
- 
getRemoteSource- Specified by:
- getRemoteSourcein interface- TransactionManager
- Returns:
- the source Sourcefor the remote end of thisTransactionManager.
 
- 
getRemoteCoordinatorDescription copied from interface:TransactionManagerReturns the remote targetTerminusfor this transaction manager which must be of typeCoordinatoror null if remote did not set a terminus.- Specified by:
- getRemoteCoordinatorin interface- TransactionManager
- Returns:
- the remote coordinator Terminusfor the remote end of this link.
 
 
-