res.add(tx.finishFuture());
}
else if (tx.concurrency() == OPTIMISTIC) {
// For OPTIMISTIC mode we wait only for txs in PREPARING state that
// have keys for given partitions.
GridCacheTxState state = tx.state();
long txTopVer = tx.topologyVersion();
if ((state == PREPARING || state == PREPARED || state == COMMITTING)
&& txTopVer > 0 && txTopVer < topVer) {
if (cctx.hasKey(tx.readSet(), parts) || cctx.hasKey(tx.writeSet(), parts))