final LockResult tryLockExclusive(long indexId, byte[] key, int hash, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_EXCLUSIVE, indexId, key, hash, nanosTimeout); }
final LockResult tryLockUpgradable(long indexId, byte[] key, int hash, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_UPGRADABLE, indexId, key, hash, nanosTimeout); }
final LockResult tryLockUpgradable(long indexId, byte[] key, int hash, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_UPGRADABLE, indexId, key, hash, nanosTimeout); }
final LockResult tryLockShared(long indexId, byte[] key, int hash, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_SHARED, indexId, key, hash, nanosTimeout); }
final LockResult tryLockShared(long indexId, byte[] key, int hash, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_SHARED, indexId, key, hash, nanosTimeout); }
final LockResult tryLockShared(long indexId, byte[] key, int hash, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_SHARED, indexId, key, hash, nanosTimeout); }
final LockResult tryLockExclusive(long indexId, byte[] key, int hash, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_EXCLUSIVE, indexId, key, hash, nanosTimeout); }
final LockResult tryLockUpgradable(long indexId, byte[] key, int hash, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_UPGRADABLE, indexId, key, hash, nanosTimeout); }
final LockResult tryLockExclusive(long indexId, byte[] key, int hash, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_EXCLUSIVE, indexId, key, hash, nanosTimeout); }
/** * Attempts to acquire an exclusive lock for the given key, denying any * additional locks. If return value is {@link LockResult#alreadyOwned * owned}, transaction already owns exclusive lock, and no extra unlock * should be performed. If {@link LockResult#ILLEGAL ILLEGAL} is returned, * transaction holds a shared lock, which cannot be upgraded. * * <p><i>Note: This method is intended for advanced use cases.</i> * * @param key non-null key to lock; instance is not cloned * @param nanosTimeout maximum time to wait for lock; negative timeout is infinite * @return {@link LockResult#ILLEGAL ILLEGAL}, {@link * LockResult#INTERRUPTED INTERRUPTED}, {@link LockResult#TIMED_OUT_LOCK * TIMED_OUT_LOCK}, {@link LockResult#ACQUIRED ACQUIRED}, {@link * LockResult#UPGRADED UPGRADED}, or {@link LockResult#OWNED_EXCLUSIVE * OWNED_EXCLUSIVE} * @throws DeadlockException if deadlock was detected after waiting full timeout */ public final LockResult tryLockExclusive(long indexId, byte[] key, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_EXCLUSIVE, indexId, key, hash(indexId, key), nanosTimeout); }
/** * Attempts to acquire an exclusive lock for the given key, denying any * additional locks. If return value is {@link LockResult#alreadyOwned * owned}, transaction already owns exclusive lock, and no extra unlock * should be performed. If {@link LockResult#ILLEGAL ILLEGAL} is returned, * transaction holds a shared lock, which cannot be upgraded. * * <p><i>Note: This method is intended for advanced use cases.</i> * * @param key non-null key to lock; instance is not cloned * @param nanosTimeout maximum time to wait for lock; negative timeout is infinite * @return {@link LockResult#ILLEGAL ILLEGAL}, {@link * LockResult#INTERRUPTED INTERRUPTED}, {@link LockResult#TIMED_OUT_LOCK * TIMED_OUT_LOCK}, {@link LockResult#ACQUIRED ACQUIRED}, {@link * LockResult#UPGRADED UPGRADED}, or {@link LockResult#OWNED_EXCLUSIVE * OWNED_EXCLUSIVE} * @throws DeadlockException if deadlock was detected after waiting full timeout */ public final LockResult tryLockExclusive(long indexId, byte[] key, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_EXCLUSIVE, indexId, key, hash(indexId, key), nanosTimeout); }
/** * Attempts to acquire an exclusive lock for the given key, denying any * additional locks. If return value is {@link LockResult#alreadyOwned * owned}, transaction already owns exclusive lock, and no extra unlock * should be performed. If {@link LockResult#ILLEGAL ILLEGAL} is returned, * transaction holds a shared lock, which cannot be upgraded. * * <p><i>Note: This method is intended for advanced use cases.</i> * * @param key non-null key to lock; instance is not cloned * @param nanosTimeout maximum time to wait for lock; negative timeout is infinite * @return {@link LockResult#ILLEGAL ILLEGAL}, {@link * LockResult#INTERRUPTED INTERRUPTED}, {@link LockResult#TIMED_OUT_LOCK * TIMED_OUT_LOCK}, {@link LockResult#ACQUIRED ACQUIRED}, {@link * LockResult#UPGRADED UPGRADED}, or {@link LockResult#OWNED_EXCLUSIVE * OWNED_EXCLUSIVE} * @throws DeadlockException if deadlock was detected after waiting full timeout */ public final LockResult tryLockExclusive(long indexId, byte[] key, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_EXCLUSIVE, indexId, key, hash(indexId, key), nanosTimeout); }
/** * Attempts to acquire an upgradable lock for the given key, denying * exclusive and additional upgradable locks. If return value is {@link * LockResult#alreadyOwned owned}, transaction already owns a strong enough * lock, and no extra unlock should be performed. If {@link * LockResult#ILLEGAL ILLEGAL} is returned, transaction holds a shared * lock, which cannot be upgraded. * * <p><i>Note: This method is intended for advanced use cases.</i> * * @param key non-null key to lock; instance is not cloned * @param nanosTimeout maximum time to wait for lock; negative timeout is infinite * @return {@link LockResult#ILLEGAL ILLEGAL}, {@link * LockResult#INTERRUPTED INTERRUPTED}, {@link LockResult#TIMED_OUT_LOCK * TIMED_OUT_LOCK}, {@link LockResult#ACQUIRED ACQUIRED}, {@link * LockResult#OWNED_UPGRADABLE OWNED_UPGRADABLE}, or {@link * LockResult#OWNED_EXCLUSIVE OWNED_EXCLUSIVE} * @throws DeadlockException if deadlock was detected after waiting full timeout */ public final LockResult tryLockUpgradable(long indexId, byte[] key, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_UPGRADABLE, indexId, key, hash(indexId, key), nanosTimeout); }
/** * Attempts to acquire an upgradable lock for the given key, denying * exclusive and additional upgradable locks. If return value is {@link * LockResult#alreadyOwned owned}, transaction already owns a strong enough * lock, and no extra unlock should be performed. If {@link * LockResult#ILLEGAL ILLEGAL} is returned, transaction holds a shared * lock, which cannot be upgraded. * * <p><i>Note: This method is intended for advanced use cases.</i> * * @param key non-null key to lock; instance is not cloned * @param nanosTimeout maximum time to wait for lock; negative timeout is infinite * @return {@link LockResult#ILLEGAL ILLEGAL}, {@link * LockResult#INTERRUPTED INTERRUPTED}, {@link LockResult#TIMED_OUT_LOCK * TIMED_OUT_LOCK}, {@link LockResult#ACQUIRED ACQUIRED}, {@link * LockResult#OWNED_UPGRADABLE OWNED_UPGRADABLE}, or {@link * LockResult#OWNED_EXCLUSIVE OWNED_EXCLUSIVE} * @throws DeadlockException if deadlock was detected after waiting full timeout */ public final LockResult tryLockUpgradable(long indexId, byte[] key, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_UPGRADABLE, indexId, key, hash(indexId, key), nanosTimeout); }
/** * Attempts to acquire a shared lock for the given key, denying exclusive * locks. If return value is {@link LockResult#alreadyOwned owned}, transaction * already owns a strong enough lock, and no extra unlock should be * performed. * * <p><i>Note: This method is intended for advanced use cases.</i> * * @param key non-null key to lock; instance is not cloned * @param nanosTimeout maximum time to wait for lock; negative timeout is infinite * @return {@link LockResult#INTERRUPTED INTERRUPTED}, {@link * LockResult#TIMED_OUT_LOCK TIMED_OUT_LOCK}, {@link LockResult#ACQUIRED * ACQUIRED}, {@link LockResult#OWNED_SHARED OWNED_SHARED}, {@link * LockResult#OWNED_UPGRADABLE OWNED_UPGRADABLE}, or {@link * LockResult#OWNED_EXCLUSIVE OWNED_EXCLUSIVE} * @throws IllegalStateException if too many shared locks * @throws DeadlockException if deadlock was detected after waiting full timeout */ public final LockResult tryLockShared(long indexId, byte[] key, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_SHARED, indexId, key, hash(indexId, key), nanosTimeout); }
/** * Attempts to acquire a shared lock for the given key, denying exclusive * locks. If return value is {@link LockResult#alreadyOwned owned}, transaction * already owns a strong enough lock, and no extra unlock should be * performed. * * <p><i>Note: This method is intended for advanced use cases.</i> * * @param key non-null key to lock; instance is not cloned * @param nanosTimeout maximum time to wait for lock; negative timeout is infinite * @return {@link LockResult#INTERRUPTED INTERRUPTED}, {@link * LockResult#TIMED_OUT_LOCK TIMED_OUT_LOCK}, {@link LockResult#ACQUIRED * ACQUIRED}, {@link LockResult#OWNED_SHARED OWNED_SHARED}, {@link * LockResult#OWNED_UPGRADABLE OWNED_UPGRADABLE}, or {@link * LockResult#OWNED_EXCLUSIVE OWNED_EXCLUSIVE} * @throws IllegalStateException if too many shared locks * @throws DeadlockException if deadlock was detected after waiting full timeout */ public final LockResult tryLockShared(long indexId, byte[] key, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_SHARED, indexId, key, hash(indexId, key), nanosTimeout); }
/** * Attempts to acquire a shared lock for the given key, denying exclusive * locks. If return value is {@link LockResult#alreadyOwned owned}, transaction * already owns a strong enough lock, and no extra unlock should be * performed. * * <p><i>Note: This method is intended for advanced use cases.</i> * * @param key non-null key to lock; instance is not cloned * @param nanosTimeout maximum time to wait for lock; negative timeout is infinite * @return {@link LockResult#INTERRUPTED INTERRUPTED}, {@link * LockResult#TIMED_OUT_LOCK TIMED_OUT_LOCK}, {@link LockResult#ACQUIRED * ACQUIRED}, {@link LockResult#OWNED_SHARED OWNED_SHARED}, {@link * LockResult#OWNED_UPGRADABLE OWNED_UPGRADABLE}, or {@link * LockResult#OWNED_EXCLUSIVE OWNED_EXCLUSIVE} * @throws IllegalStateException if too many shared locks * @throws DeadlockException if deadlock was detected after waiting full timeout */ public final LockResult tryLockShared(long indexId, byte[] key, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_SHARED, indexId, key, hash(indexId, key), nanosTimeout); }
/** * Attempts to acquire an upgradable lock for the given key, denying * exclusive and additional upgradable locks. If return value is {@link * LockResult#alreadyOwned owned}, transaction already owns a strong enough * lock, and no extra unlock should be performed. If {@link * LockResult#ILLEGAL ILLEGAL} is returned, transaction holds a shared * lock, which cannot be upgraded. * * <p><i>Note: This method is intended for advanced use cases.</i> * * @param key non-null key to lock; instance is not cloned * @param nanosTimeout maximum time to wait for lock; negative timeout is infinite * @return {@link LockResult#ILLEGAL ILLEGAL}, {@link * LockResult#INTERRUPTED INTERRUPTED}, {@link LockResult#TIMED_OUT_LOCK * TIMED_OUT_LOCK}, {@link LockResult#ACQUIRED ACQUIRED}, {@link * LockResult#OWNED_UPGRADABLE OWNED_UPGRADABLE}, or {@link * LockResult#OWNED_EXCLUSIVE OWNED_EXCLUSIVE} * @throws DeadlockException if deadlock was detected after waiting full timeout */ public final LockResult tryLockUpgradable(long indexId, byte[] key, long nanosTimeout) throws DeadlockException { return tryLock(TYPE_UPGRADABLE, indexId, key, hash(indexId, key), nanosTimeout); }