ptupitsyn commented on a change in pull request #6734: IGNITE-9410 Thin client 
transactions support
URL: https://github.com/apache/ignite/pull/6734#discussion_r314215128
 
 

 ##########
 File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/ClientConnectionContext.java
 ##########
 @@ -216,4 +241,61 @@ public ClientAffinityTopologyVersion 
checkAffinityTopologyVersion() {
             return new ClientAffinityTopologyVersion(newVer, changed);
         }
     }
+
+    /**
+     * Next transaction id for this connection.
+     */
+    public int nextTxId() {
+        int txId = txIdSeq.incrementAndGet();
+
+        return txId == 0 ? txIdSeq.incrementAndGet() : txId;
+    }
+
+    /**
+     * Transaction context by transaction id.
+     *
+     * @param txId Tx ID.
+     */
+    public ClientTxContext txContext(int txId) {
+        return txs.get(txId);
+    }
+
+    /**
+     * Add new transaction context to connection.
+     *
+     * @param txCtx Tx context.
+     */
+    public void addTxContext(ClientTxContext txCtx) {
+        if (txsCnt.incrementAndGet() > ACTIVE_TX_LIMIT) {
+            txsCnt.decrementAndGet();
+
+            throw new IgniteClientException(ClientStatus.TX_LIMIT_EXCEEDED, 
"Active transactions per connection limit " +
+                "(" + ACTIVE_TX_LIMIT + ") exceeded. To start a new 
transaction you need to wait for some of currently " +
+                "active transactions complete. To change the limit set up " + 
IGNITE_THIN_MAX_ACTIVE_TX_PER_CONNECTION +
 
 Review comment:
   See above, let's not use system properties for this.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to