Search in sources :

Example 11 with RedissonLock

use of org.redisson.RedissonLock in project redisson by redisson.

the class BucketCompareAndSetOperation method commit.

@Override
public void commit(CommandAsyncExecutor commandExecutor) {
    RedissonBucket<V> bucket = new RedissonBucket<V>(codec, commandExecutor, name);
    bucket.compareAndSetAsync(expected, 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 RedissonLock

use of org.redisson.RedissonLock in project redisson by redisson.

the class BucketGetAndSetOperation 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 RedissonLock

use of org.redisson.RedissonLock in project redisson by redisson.

the class BucketGetAndSetOperation method commit.

@Override
public void commit(CommandAsyncExecutor commandExecutor) {
    RBucket<V> bucket = new RedissonBucket<V>(codec, commandExecutor, name);
    if (timeToLive != 0) {
        bucket.getAndSetAsync((V) value, timeToLive, timeUnit);
    } else {
        bucket.getAndSetAsync((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 14 with RedissonLock

use of org.redisson.RedissonLock 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 15 with RedissonLock

use of org.redisson.RedissonLock in project redisson by redisson.

the class UnlinkOperation method rollback.

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

Aggregations

RedissonLock (org.redisson.RedissonLock)16 RedissonTransactionalLock (org.redisson.transaction.RedissonTransactionalLock)12 RedissonBucket (org.redisson.RedissonBucket)5 RedissonKeys (org.redisson.RedissonKeys)3 RKeys (org.redisson.api.RKeys)3