Search in sources :

Example 1 with ClientIntResponse

use of org.apache.ignite.internal.processors.platform.client.ClientIntResponse in project ignite by apache.

the class ClientTxStartRequest method process.

/**
 * {@inheritDoc}
 */
@Override
public ClientResponse process(ClientConnectionContext ctx) {
    GridNearTxLocal tx;
    ctx.kernalContext().gateway().readLock();
    try {
        tx = ctx.kernalContext().cache().context().tm().newTx(false, false, null, concurrency, isolation, timeout, true, null, 0, lb, false);
    } finally {
        ctx.kernalContext().gateway().readUnlock();
    }
    try {
        tx.suspend();
        int txId = ctx.nextTxId();
        ctx.addTxContext(new ClientTxContext(txId, tx));
        return new ClientIntResponse(requestId(), txId);
    } catch (Exception e) {
        try {
            tx.close();
        } catch (Exception e1) {
            e.addSuppressed(e1);
        }
        throw (e instanceof IgniteClientException) ? (IgniteClientException) e : new IgniteClientException(ClientStatus.FAILED, e.getMessage(), e);
    }
}
Also used : IgniteClientException(org.apache.ignite.internal.processors.platform.client.IgniteClientException) ClientIntResponse(org.apache.ignite.internal.processors.platform.client.ClientIntResponse) GridNearTxLocal(org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal) IgniteClientException(org.apache.ignite.internal.processors.platform.client.IgniteClientException)

Aggregations

GridNearTxLocal (org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal)1 ClientIntResponse (org.apache.ignite.internal.processors.platform.client.ClientIntResponse)1 IgniteClientException (org.apache.ignite.internal.processors.platform.client.IgniteClientException)1