---
title: Client Transactions
---

<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->


The syntax for writing client transactions is the same on the Java client as with any other <%=vars.product_name%> 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 <%=vars.product_name%> Cache Transaction](run_a_cache_transaction.html#task_f15_mr3_5k).

-   **[How <%=vars.product_name%> Runs Client Transactions](client_server_transactions.html#how_gemfire_runs_clients)**

-   **[Client Cache Access During a Transaction](client_server_transactions.html#client_cache_access)**

-   **[Client Transactions and Client Application Plug-Ins](client_server_transactions.html#client_app_plugins)**

-   **[Client Transaction Failures](client_server_transactions.html#client_transaction_failures)**

## <a id="how_gemfire_runs_clients" class="no-quick-link"></a>How <%=vars.product_name%> Runs Client Transactions

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 makes changes to data entries Y and Z within a transaction. The delegate performing the transaction (M1) does not host the primary copy of the data being modified. The transaction takes place on the server containing this data (M2).

<img src="../../images/transactions-client-1.png" id="how_gemfire_runs_clients__image_5DCA65F2B88F450299EFD19DAAA93D4F" class="image" />

## <a id="client_cache_access" class="no-quick-link"></a>Client Cache Access During a Transaction

To maintain cache consistency, <%=vars.product_name%> 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.

## <a id="client_app_plugins" class="no-quick-link"></a>Client Transactions and Client Application Plug-Ins

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.

## <a id="client_transaction_failures" class="no-quick-link"></a>Client Transaction Failures

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](monitor_troubleshoot_transactions.html#monitor_troubleshoot_transactions__section_8942ABA6F23C4ED58877C894B13F4F21).


