Class ProtonTransaction<E extends Endpoint<?>>
java.lang.Object
org.apache.qpid.protonj2.engine.impl.ProtonTransaction<E>
- Type Parameters:
E- The parent type for thisTransaction
- All Implemented Interfaces:
Transaction<E>
public abstract class ProtonTransaction<E extends Endpoint<?>>
extends Object
implements Transaction<E>
Base
Transaction implementation that provides the basic functionality needed
to manage the Transaction that it represents.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.qpid.protonj2.engine.Transaction
Transaction.DischargeState -
Constructor Summary
Constructors -
Method Summary
Modifier 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.abstract Eparent()Overridden by theTransactionControllerorTransactionManagerthat creates thisTransactioninstance, this method returns the parent instance that created it.voidsetLinkedResource(Object resource) Links a given resource to thisTransaction.
-
Constructor Details
-
ProtonTransaction
public ProtonTransaction()
-
-
Method Details
-
getState
- Specified by:
getStatein interfaceTransaction<E extends Endpoint<?>>- Returns:
- the current
Transactionstate.
-
isDeclared
public boolean isDeclared()- Specified by:
isDeclaredin interfaceTransaction<E extends Endpoint<?>>- Returns:
- true if the
Transactionhas been marked declared by theTransactionManager.
-
isDischarged
public boolean isDischarged()- Specified by:
isDischargedin interfaceTransaction<E extends Endpoint<?>>- Returns:
- true if the
Transactionhas been marked discharged by theTransactionManager.
-
isFailed
public boolean isFailed()Description copied from interface:TransactionThe 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.- Specified by:
isFailedin interfaceTransaction<E extends Endpoint<?>>- Returns:
- true if the
Transactionhas been marked failed by the parent resource.
-
getCondition
Description copied from interface:TransactionIf 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.- Specified by:
getConditionin interfaceTransaction<E extends Endpoint<?>>- Returns:
- the
ErrorConditionthat theTransactionManagerused to fail theTransaction.
-
getDischargeState
Description copied from interface:TransactionFor 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.- Specified by:
getDischargeStatein interfaceTransaction<E extends Endpoint<?>>- Returns:
- the current
Transaction.DischargeStateof the transaction.
-
getTxnId
Description copied from interface:TransactionReturns 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.- Specified by:
getTxnIdin interfaceTransaction<E extends Endpoint<?>>- Returns:
- the transaction Id associated with the transaction once successfully declared.
-
setLinkedResource
Description copied from interface:TransactionLinks a given resource to thisTransaction.- Specified by:
setLinkedResourcein interfaceTransaction<E extends Endpoint<?>>- Parameters:
resource- The resource to link to thisTransaction.
-
getLinkedResource
- Specified by:
getLinkedResourcein interfaceTransaction<E extends Endpoint<?>>- Returns:
- the user set linked resource for this
Transactioninstance.
-
getLinkedResource
Description copied from interface:TransactionGets the linked resource (if set) and returns it using the type information provided to cast the returned value.- Specified by:
getLinkedResourcein interfaceTransaction<E extends Endpoint<?>>- 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.
-
getAttachments
- Specified by:
getAttachmentsin interfaceTransaction<E extends Endpoint<?>>- Returns:
- the
Attachmentsinstance that is associated with thisTransaction
-
parent
Overridden by theTransactionControllerorTransactionManagerthat creates thisTransactioninstance, this method returns the parent instance that created it.- Specified by:
parentin interfaceTransaction<E extends Endpoint<?>>- Returns:
- the resource that created this
Transaction.
-