Package org.apache.qpid.protonj2.engine
Interface Transaction<E extends Endpoint<?>>
- Type Parameters:
- E- The parent of this Transaction either a- TransactionControlleror- TransactionManager
- All Known Implementing Classes:
- ProtonTransaction
public interface Transaction<E extends Endpoint<?>>
A Transaction object that hold information and context for a single 
Transaction.- 
Nested Class SummaryNested Classes
- 
Method SummaryModifier and TypeMethodDescriptionIf the declare or discharge of the transaction caused its state to becomeTransactionStateFAILED this method returns theErrorConditionthat the remote used to describe the reason for the failure.For aTransactionthat has either been requested to discharge or has successfully discharged theTransaction.DischargeStatereflects whether the transaction was to be committed or rolled back.<T> TgetLinkedResource(Class<T> typeClass) Gets the linked resource (if set) and returns it using the type information provided to cast the returned value.getState()getTxnId()Returns the transaction Id that is associated with the declared transaction.booleanbooleanbooleanisFailed()The parent resource will mark theTransactionas failed is any of the operations performed on it cannot be successfully completed such as aDeclareoperation failing to write due to an IO error.parent()Returns a reference to the parent of thisTransactionwhich will be either aTransactionControlleror aTransactionManagermanager depending on the end of theLinkthat is operating on theTransaction.voidsetLinkedResource(Object resource) Links a given resource to thisTransaction.
- 
Method Details- 
getStateTransactionState getState()- Returns:
- the current Transactionstate.
 
- 
getDischargeStateTransaction.DischargeState getDischargeState()For aTransactionthat has either been requested to discharge or has successfully discharged theTransaction.DischargeStatereflects whether the transaction was to be committed or rolled back. Prior to a discharge being attempted there is no state value and this method returns aTransaction.DischargeStateof none.- Returns:
- the current Transaction.DischargeStateof the transaction.
 
- 
isDeclaredboolean isDeclared()- Returns:
- true if the Transactionhas been marked declared by theTransactionManager.
 
- 
isDischargedboolean isDischarged()- Returns:
- true if the Transactionhas been marked discharged by theTransactionManager.
 
- 
isFailedboolean isFailed()The parent resource will mark theTransactionas failed is any of the operations performed on it cannot be successfully completed such as aDeclareoperation failing to write due to an IO error.- Returns:
- true if the Transactionhas been marked failed by the parent resource.
 
- 
getConditionErrorCondition getCondition()If the declare or discharge of the transaction caused its state to becomeTransactionStateFAILED this method returns theErrorConditionthat the remote used to describe the reason for the failure.- Returns:
- the ErrorConditionthat theTransactionManagerused to fail theTransaction.
 
- 
parentE parent()Returns a reference to the parent of thisTransactionwhich will be either aTransactionControlleror aTransactionManagermanager depending on the end of theLinkthat is operating on theTransaction.- Returns:
- a reference to the parent of this Transaction.
 
- 
getTxnIdBinary getTxnId()Returns the transaction Id that is associated with the declared transaction. Prior to aTransactionManagercompleting a transaction declaration this method will return null to indicate that the transaction has not been declared yet.- Returns:
- the transaction Id associated with the transaction once successfully declared.
 
- 
getAttachmentsAttachments getAttachments()- Returns:
- the Attachmentsinstance that is associated with thisTransaction
 
- 
setLinkedResourceLinks a given resource to thisTransaction.- Parameters:
- resource- The resource to link to this- Transaction.
 
- 
getLinkedResourceObject getLinkedResource()- Returns:
- the user set linked resource for this Transactioninstance.
 
- 
getLinkedResourceGets the linked resource (if set) and returns it using the type information provided to cast the returned value.- Type Parameters:
- T- The type to cast the linked resource to if one is set.
- Parameters:
- typeClass- the type's Class which is used for casting the returned value.
- Returns:
- the user set linked resource for this Context instance.
- Throws:
- ClassCastException- if the linked resource cannot be cast to the type requested.
 
 
-