tkalkirill commented on code in PR #13264:
URL: https://github.com/apache/ignite/pull/13264#discussion_r3489139851
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java:
##########
@@ -1345,6 +1345,61 @@ public boolean lock(K key, long timeout)
*/
public boolean isLocked(K key);
+ /**
+ * Acquires a transactional lock for the cached object represented by the
given entry if the current cached version
+ * matches the entry version. This method works only in a {@link
TransactionConcurrency#PESSIMISTIC} transaction.
+ *
+ * @param entry Entry whose key, value and version should be used.
+ * @param waitTimeout Timeout in milliseconds to wait for lock to be
acquired
+ * ({@code 0} to use the transaction timeout, {@code -1} for
immediate failure if
+ * lock cannot be acquired immediately).
+ * @return {@code True} if lock was acquired with the same entry version.
+ * @throws IgniteCheckedException If lock acquisition resulted in an error.
+ */
+ public boolean lockTxEntry(CacheEntry<K, V> entry, long waitTimeout)
throws IgniteCheckedException;
+
+ /**
+ * Acquires transactional locks for the cached objects represented by the
given entries if all current cached
+ * versions match the corresponding entry versions. This method works only
in a
+ * {@link TransactionConcurrency#PESSIMISTIC} transaction.
+ *
+ * @param entries Entries whose keys, values and versions should be used.
+ * @param waitTimeout Timeout in milliseconds to wait for locks to be
acquired
+ * ({@code 0} to use the transaction timeout, {@code -1} for
immediate failure if
+ * locks cannot be acquired immediately).
+ * @return {@code True} if all locks were acquired with the same entry
versions.
+ * @throws IgniteCheckedException If lock acquisition resulted in an error.
+ */
+ public boolean lockTxEntries(Collection<CacheEntry<K, V>> entries, long
waitTimeout) throws IgniteCheckedException;
+
+ /**
+ * Asynchronously acquires a transactional lock for the cached object
represented by the given entry if the current
+ * cached version matches the entry version. This method works only in a
+ * {@link TransactionConcurrency#PESSIMISTIC} transaction.
+ *
+ * @param entry Entry whose key, value and version should be used.
+ * @param waitTimeout Timeout in milliseconds to wait for lock to be
acquired
+ * ({@code 0} to use the transaction timeout, {@code -1} for
immediate failure if
+ * lock cannot be acquired immediately).
+ * @return Future that resolves to {@code true} if the lock was acquired
and the versions matched, or to
+ * {@code false} otherwise.
+ */
+ public IgniteInternalFuture<Boolean> lockTxEntryAsync(CacheEntry<K, V>
entry, long waitTimeout);
Review Comment:
I’m not insisting, but it would be great if you could generally mention in
the documentation what kind of errors the future might complete with.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]