Search in sources :

Example 1 with RedissonLock

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

the class BucketGetAndDeleteOperation method commit.

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

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

the class BucketSetOperation method commit.

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

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

the class BucketSetOperation 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 4 with RedissonLock

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

the class DeleteOperation method rollback.

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

Example 5 with RedissonLock

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

the class DeleteOperation method commit.

@Override
public void commit(CommandAsyncExecutor commandExecutor) {
    RKeys keys = new RedissonKeys(commandExecutor);
    keys.deleteAsync(getName());
    if (lockName != null) {
        RedissonLock lock = new RedissonTransactionalLock(commandExecutor, lockName, transactionId);
        lock.unlockAsync();
    }
}
Also used : RKeys(org.redisson.api.RKeys) RedissonLock(org.redisson.RedissonLock) RedissonTransactionalLock(org.redisson.transaction.RedissonTransactionalLock) RedissonKeys(org.redisson.RedissonKeys)

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