Package com.oracle.microtx.tcc
Class MicroTxTccClient
java.lang.Object
com.oracle.microtx.tcc.MicroTxTccClient
- All Implemented Interfaces:
TccClient
TccTransaction - Helper class to execute current tcc transactions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParticipant<wbr>(String uri)voidaddTccParticipant<wbr>(String uri)Add a participant to the current TCC transactioncancel()Cancel the TCC transactioncancel<wbr>(List<TccParticipant> participants)Cancel the TCC transaction optionally adding additional participantscancelTccWithOptionalParticipant<wbr>(List<TccParticipant> participants)confirm()Confirm the TCC transactionconfirm<wbr>(List<TccParticipant> participants)Confirm the TCC transaction optionally adding additional participantsconfirmTccWithOptionalParticipants<wbr>(List<TccParticipant> participants)longlongGet the time limit in milliseconds for the current TCC transaction This value overrides the value set via @TCC annotationGet the current transaction idvoidsetTccTimeLimit<wbr>(long timeLimit)voidsetTimeLimit<wbr>(long timeLimit)Set the time limit in milliseconds for the current transaction.
-
Constructor Details
-
MicroTxTccClient
public MicroTxTccClient()
-
-
Method Details
-
confirm
public ConfirmResponse confirm() throws TccUnknownTransactionException, TccHeuristicException, TccExceptionConfirm the TCC transactionThis asks the transaction coordinator to confirm all the participants in the transaction.
- Specified by:
confirmin interfaceTccClient- Returns:
- returns the list of participants with their updated state
- Throws:
TccException- some failure occurred communicating with the transaction coordinatorTccUnknownTransactionException- transaction not found or unknown error at coordinator sideTccHeuristicException- not all the participants confirmed
-
confirm
public ConfirmResponse confirm<wbr>(List<TccParticipant> participants) throws TccUnknownTransactionException, TccHeuristicException, TccExceptionConfirm the TCC transaction optionally adding additional participantsThis asks the transaction coordinator to confirm all the participants in the transaction including those added by this call.
- Parameters:
participants- list of TccParticipants to be included in the confirmation of the transaction- Returns:
- returns the list of participants with their updated state
- Throws:
TccException- some failure occurred communicating with the transaction coordinatorTccUnknownTransactionException- transaction not found or unknown error at coordinator sideTccHeuristicException- not all the participants confirmed
-
cancel
public CancelResponse cancel() throws TccUnknownTransactionException, TccHeuristicException, TccExceptionCancel the TCC transactionThis asks the transaction coordinator to cancel all the participants.
- Specified by:
cancelin interfaceTccClient- Returns:
- CancelResponse includes participants and transaction status
- Throws:
TccException- some failure occurred communicating with the transaction coordinatorTccUnknownTransactionException- transaction not found or unknown error at coordinator sideTccHeuristicException- not all the participants cancelled
-
cancel
public CancelResponse cancel<wbr>(List<TccParticipant> participants) throws TccUnknownTransactionException, TccHeuristicException, TccExceptionCancel the TCC transaction optionally adding additional participantsThis asks the transaction coordinator to cancel all the participants in the transaction including those added by this call.
- Parameters:
participants- optional list of TccParticipants to be included in the cancelling of the transaction- Returns:
- CancelResponse includes participants and transaction status
- Throws:
TccException- some failure occurred communicating with the transaction coordinatorTccUnknownTransactionException- transaction not found or unknown error at coordinator sideTccHeuristicException- not all the participants cancelled
-
getTransactionId
Get the current transaction id- Returns:
- transaction id
- Throws:
TccUnknownTransactionException- TCC transaction is associated to the current thread
-
addTccParticipant
Add a participant to the current TCC transaction- Parameters:
uri- the URI of the participant resource- Throws:
TccUnknownTransactionException- TCC transaction is associated to the current thread
-
setTimeLimit
Set the time limit in milliseconds for the current transaction. This will override the time limit set using @TCC annotation- Parameters:
timeLimit- time limit in milliseconds- Throws:
TccUnknownTransactionException- TCC transaction is associated to the current thread
-
getTimeLimit
Get the time limit in milliseconds for the current TCC transaction This value overrides the value set via @TCC annotation- Returns:
- time limit in milliseconds for the current TCC transaction
- Throws:
TccUnknownTransactionException- TCC transaction is associated to the current thread
-
confirmTccWithOptionalParticipants
public ConfirmResponse confirmTccWithOptionalParticipants<wbr>(List<TccParticipant> participants) throws TccUnknownTransactionException, TccHeuristicException, TccException- Specified by:
confirmTccWithOptionalParticipantsin interfaceTccClient- Throws:
TccUnknownTransactionExceptionTccHeuristicExceptionTccException
-
cancelTccWithOptionalParticipant
public CancelResponse cancelTccWithOptionalParticipant<wbr>(List<TccParticipant> participants) throws TccUnknownTransactionException, TccHeuristicException, TccException- Specified by:
cancelTccWithOptionalParticipantin interfaceTccClient- Throws:
TccUnknownTransactionExceptionTccHeuristicExceptionTccException
-
setTccTimeLimit
- Specified by:
setTccTimeLimitin interfaceTccClient- Throws:
TccUnknownTransactionException
-
getTccTimeLimit
- Specified by:
getTccTimeLimitin interfaceTccClient- Throws:
TccUnknownTransactionException
-
addParticipant
- Specified by:
addParticipantin interfaceTccClient- Throws:
TccUnknownTransactionException
-
getTccTransactionId
- Specified by:
getTccTransactionIdin interfaceTccClient- Throws:
TccUnknownTransactionException
-