Search in sources :

Example 11 with RedissonTransactionalLock

use of org.redisson.transaction.RedissonTransactionalLock in project redisson by redisson.

the class BucketTrySetOperation method commit.

@Override
public void commit(CommandAsyncExecutor commandExecutor) {
    RedissonBucket<V> bucket = new RedissonBucket<V>(codec, commandExecutor, name);
    if (timeToLive != 0) {
        bucket.trySetAsync((V) value, timeToLive, timeUnit);
    } else {
        bucket.trySetAsync((V) value);
    }
    RedissonLock lock = new RedissonTransactionalLock(commandExecutor, lockName, transactionId);
    lock.unlockAsync(getThreadId());
}
Also used : RedissonLock(org.redisson.RedissonLock) RedissonTransactionalLock(org.redisson.transaction.RedissonTransactionalLock) RedissonBucket(org.redisson.RedissonBucket)

Example 12 with RedissonTransactionalLock

use of org.redisson.transaction.RedissonTransactionalLock in project redisson by redisson.

the class BucketGetAndDeleteOperation method rollback.

@Override
public void rollback(CommandAsyncExecutor commandExecutor) {
    RedissonLock lock = new RedissonTransactionalLock(commandExecutor, lockName, transactionId);
    lock.unlockAsync(getThreadId());
}
Also used : RedissonLock(org.redisson.RedissonLock) RedissonTransactionalLock(org.redisson.transaction.RedissonTransactionalLock)

Example 13 with RedissonTransactionalLock

use of org.redisson.transaction.RedissonTransactionalLock in project redisson by redisson.

the class BucketsTrySetOperation method unlock.

protected void unlock(CommandAsyncExecutor commandExecutor) {
    for (String key : values.keySet()) {
        RLock lock = new RedissonTransactionalLock(commandExecutor, getLockName(key), transactionId);
        lock.unlockAsync();
    }
}
Also used : RedissonTransactionalLock(org.redisson.transaction.RedissonTransactionalLock) RLock(org.redisson.api.RLock)

Aggregations

RedissonTransactionalLock (org.redisson.transaction.RedissonTransactionalLock)13 RedissonLock (org.redisson.RedissonLock)12 RedissonBucket (org.redisson.RedissonBucket)5 RedissonKeys (org.redisson.RedissonKeys)1 RKeys (org.redisson.api.RKeys)1 RLock (org.redisson.api.RLock)1