Transaction

classTransaction


The Transaction class encapsulates the functionality needed to perform a transaction on the data at a location. To run a transaction, provide aHandler torunTransaction. That handler will be passed the current data at the location, and must return aResult. AResult can be created using eithersuccess orabort.

Summary

Nested types

An object implementing this interface is used to run a transaction, and will be notified of the results of the transaction.

Instances of this class represent the desired outcome of a single run of aHandler's doTransaction method.

Public constructors

Public functions

java-staticTransaction.Result
java-staticTransaction.Result
success(resultData: MutableData)

Public constructors

Transaction

Transaction()

Public functions

abort

java-static fun abort(): Transaction.Result
Returns
Transaction.Result

AResult that aborts the transaction

success

java-static fun success(resultData: MutableData): Transaction.Result
Parameters
resultData: MutableData

The desired data at the location

Returns
Transaction.Result

AResult indicating the new data to be stored at the location

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-21 UTC.