Package com.couchbase.transactions
Class TransactionResult
- java.lang.Object
-
- com.couchbase.transactions.TransactionResult
-
public class TransactionResult extends java.lang.Object
Provides some debugging and logging facilities for tracking what happened during a transaction.Note that the success or failure of a transaction is determined solely by whether an a
TransactionFailed
exception is thrown by it.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.List<TransactionAttempt>
attempts()
Deprecated.since 1.1.4, this field should no longer be used.TransactionLogger
log()
An in-memory log is built up during each transaction.com.couchbase.client.java.kv.MutationState
mutationState()
Returns the finalMutationState
for each document involved in the transaction, after it's committed or rolled back.java.util.List<com.couchbase.client.core.msg.kv.MutationToken>
mutationTokens()
Returns the final mutation token for each document involved in the transaction, after it's committed or rolled back.java.util.Optional<TransactionSerializedContext>
serialized()
Returns a serialized representation of a deferred transaction, suitable for later commit or rollback.java.time.Duration
timeTaken()
Returns the total time taken by a transaction.java.lang.String
toString()
java.lang.String
transactionId()
Returns the id of this transaction.boolean
unstagingComplete()
Returns whether all documents were successfully unstaged (committed).
-
-
-
Method Detail
-
log
public TransactionLogger log()
An in-memory log is built up during each transaction. The application may want to write this to their own logs, for example upon transaction failure.
-
attempts
@Deprecated public java.util.List<TransactionAttempt> attempts()
Deprecated.since 1.1.4, this field should no longer be used.A transaction consists of one or more attempts to commit the provided transaction logic. This returns a time-ordered summary of these attempts, for debugging purposes.
-
timeTaken
public java.time.Duration timeTaken()
Returns the total time taken by a transaction.
-
transactionId
public java.lang.String transactionId()
Returns the id of this transaction.
-
mutationTokens
public java.util.List<com.couchbase.client.core.msg.kv.MutationToken> mutationTokens()
Returns the final mutation token for each document involved in the transaction, after it's committed or rolled back. This can be used to ensure consistency with N1QL and FTS queries, though the `mutationState` method is more convenient for this. It should be disregarded if the transaction did not successfully complete, e.g. if it threw an exception. Note: Mutation tokens must be enabled on the Cluster configuration in order for this to be non-empty.
-
serialized
@Volatile public java.util.Optional<TransactionSerializedContext> serialized()
Returns a serialized representation of a deferred transaction, suitable for later commit or rollback. This will only be present if the application calledAttemptContext.defer()
on the transaction.
-
mutationState
public com.couchbase.client.java.kv.MutationState mutationState()
Returns the finalMutationState
for each document involved in the transaction, after it's committed or rolled back. This can be used to ensure consistency with N1QL and FTS queries. It should be disregarded if the transaction did not successfully complete, e.g. if it threw an exception. Note: Mutation tokens must be enabled on the Cluster configuration in order for this to be non-empty.
-
unstagingComplete
public boolean unstagingComplete()
Returns whether all documents were successfully unstaged (committed). This will only return true if the transaction reached the COMMIT point and then went on to reach the COMPLETE point. It will be false for transactions that: - Rolled back - Were read-only
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-