[ 
https://issues.apache.org/jira/browse/IGNITE-28897?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladislav Pyatkov updated IGNITE-28897:
---------------------------------------
    Description: 
Change the behavior of lockTxEntry, lockTxEntries, and the async* variants: 
instead of `boolean` they have to return `ACQUIRED`, `LOCK_CONFLICT` or 
`VERSION_MISMATCH`.
{code}
public enum TxLockResult {
    /** All locks were acquired and entry versions matched. */
    ACQUIRED,

    /** A lock could not be acquired within the specified timeout. */
    LOCK_CONFLICT,

    /** A lock could not be acquired, due to entry versions mismatching the 
expected ones. */
    VERSION_MISMATCH
}
{code}
Changed API:
{code}
TxLockResult lockTxEntry(
    CacheEntry<K, V> entry,
    long waitTimeout
) throws IgniteCheckedException;

TxLockResult lockTxEntries(
    Collection<CacheEntry<K, V>> entries,
    long waitTimeout
) throws IgniteCheckedException;

IgniteInternalFuture<TxLockResult> lockTxEntryAsync(
    CacheEntry<K, V> entry,
    long waitTimeout
);

IgniteInternalFuture<TxLockResult> lockTxEntriesAsync(
    Collection<CacheEntry<K, V>> entries,
    long waitTimeout
);
{code}



  was:
Change the behavior of lockTxEntry, lockTxEntries, and the async* variants: 
instead of `boolean` they have to return `ACQUIRED`, `LOCK_CONFLICT` or 
`VERSION_MISMATCH`.
{code}
public enum TxLockResult {
    /** All locks were acquired and entry versions matched. */
    ACQUIRED,

    /** A lock could not be acquired within the specified timeout. */
    LOCK_CONFLICT,

    /** Locks were acquired, but at least one entry version changed. */
    VERSION_MISMATCH
}
{code}
Changed API:
{code}
TxLockResult lockTxEntry(
    CacheEntry<K, V> entry,
    long waitTimeout
) throws IgniteCheckedException;

TxLockResult lockTxEntries(
    Collection<CacheEntry<K, V>> entries,
    long waitTimeout
) throws IgniteCheckedException;

IgniteInternalFuture<TxLockResult> lockTxEntryAsync(
    CacheEntry<K, V> entry,
    long waitTimeout
);

IgniteInternalFuture<TxLockResult> lockTxEntriesAsync(
    Collection<CacheEntry<K, V>> entries,
    long waitTimeout
);
{code}




> Return detailed result from transactional lock API
> --------------------------------------------------
>
>                 Key: IGNITE-28897
>                 URL: https://issues.apache.org/jira/browse/IGNITE-28897
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Vladislav Pyatkov
>            Priority: Major
>              Labels: ignite-2
>
> Change the behavior of lockTxEntry, lockTxEntries, and the async* variants: 
> instead of `boolean` they have to return `ACQUIRED`, `LOCK_CONFLICT` or 
> `VERSION_MISMATCH`.
> {code}
> public enum TxLockResult {
>     /** All locks were acquired and entry versions matched. */
>     ACQUIRED,
>     /** A lock could not be acquired within the specified timeout. */
>     LOCK_CONFLICT,
>     /** A lock could not be acquired, due to entry versions mismatching the 
> expected ones. */
>     VERSION_MISMATCH
> }
> {code}
> Changed API:
> {code}
> TxLockResult lockTxEntry(
>     CacheEntry<K, V> entry,
>     long waitTimeout
> ) throws IgniteCheckedException;
> TxLockResult lockTxEntries(
>     Collection<CacheEntry<K, V>> entries,
>     long waitTimeout
> ) throws IgniteCheckedException;
> IgniteInternalFuture<TxLockResult> lockTxEntryAsync(
>     CacheEntry<K, V> entry,
>     long waitTimeout
> );
> IgniteInternalFuture<TxLockResult> lockTxEntriesAsync(
>     Collection<CacheEntry<K, V>> entries,
>     long waitTimeout
> );
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to