use of org.apache.ignite.internal.processors.platform.client.tx.ClientTxContext in project ignite by apache.
the class ClientRequestHandler method handle.
/**
* {@inheritDoc}
*/
@Override
public ClientListenerResponse handle(ClientListenerRequest req) {
try {
if (req instanceof ClientTxAwareRequest) {
ClientTxAwareRequest req0 = (ClientTxAwareRequest) req;
if (req0.isTransactional()) {
int txId = req0.txId();
ClientTxContext txCtx = ctx.txContext(txId);
if (txCtx != null) {
try {
txCtx.acquire(true);
return ((ClientRequest) req).process(ctx);
} catch (IgniteCheckedException e) {
throw new IgniteClientException(ClientStatus.FAILED, e.getMessage(), e);
} finally {
try {
txCtx.release(true);
} catch (Exception e) {
log.warning("Failed to release client transaction context", e);
}
}
}
}
}
return ((ClientRequest) req).process(ctx);
} catch (SecurityException ex) {
throw new IgniteClientException(ClientStatus.SECURITY_VIOLATION, "Client is not authorized to perform this operation", ex);
}
}
Aggregations