The syntax for writing client transactions is the same on the Java client as with any other GemFire member, but the underlying behavior in a client-run transaction is different from general transaction behavior.
For general information about running a transaction, refer to How to Run a GemFire Cache Transaction.
When a client performs a transaction, the transaction is delegated to a server that acts as the transaction initiator in the server system. As with regular, non-client transactions, this server delegate may or may not be the transaction host.
In this figure, the application code on the client (M1) makes changes to data entries Y and Z within a transaction. The delegate performing the transaction (M2) does not host the primary copy of the data being modified. The transaction takes place on the server containing this data (M3).
To maintain cache consistency, GemFire blocks access to the local client cache during a transaction. The local client cache may reflect information inconsistent with the transaction in progress. When the transaction completes, the local cache is accessible again.
Any plug-ins installed in the client are not invoked by the client-run transaction. The client that initiates the transaction receives changes from its server based on transaction operations the same as any other client - through mechanisms like subscriptions and continuous query results. The client transaction is performed by the server delegate, where application plug-ins operate the same as if the server were the sole initiator of the transaction.
In addition to the failure conditions common to all transactions, client transactions can fail if the transaction delegate fails. If the delegate performing the transaction fails, the transaction code throws a transaction exception. See Transaction Exceptions.