Package org.redisson.transaction
Class RedissonTransaction
- java.lang.Object
-
- org.redisson.transaction.RedissonTransaction
-
- All Implemented Interfaces:
RTransaction
public class RedissonTransaction extends Object implements RTransaction
- Author:
- Nikita Koksharov
-
-
Constructor Summary
Constructors Constructor Description RedissonTransaction(CommandAsyncExecutor commandExecutor, TransactionOptions options)RedissonTransaction(CommandAsyncExecutor commandExecutor, TransactionOptions options, List<TransactionalOperation> operations, Set<String> localCaches)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckState()voidcommit()Commits all changes made on this transaction.voidcommit(Set<String> localCaches, List<TransactionalOperation> operations)RFuture<Void>commitAsync()Commits all changes made on this transaction in async mode.protected static StringgenerateId()<V> RBucket<V>getBucket(String name)Returns transactional object holder instance by name.<V> RBucket<V>getBucket(String name, Codec codec)Returns transactional object holder instance by name using provided codec for object.RBucketsgetBuckets()Returns transactional interface for mass operations with Bucket objects.RBucketsgetBuckets(Codec codec)Returns transactional interface for mass operations with Bucket objects using provided codec for object.<K,V>
RLocalCachedMap<K,V>getLocalCachedMap(RLocalCachedMap<K,V> fromInstance)Returns transactional local cached map proxy for specified local cached map instance.Set<String>getLocalCaches()<K,V>
RMap<K,V>getMap(String name)Returns transactional map instance by name.<K,V>
RMap<K,V>getMap(String name, Codec codec)Returns transactional map instance by name using provided codec for both map keys and values.<K,V>
RMapCache<K,V>getMapCache(String name)Returns transactional map-based cache instance by name.<K,V>
RMapCache<K,V>getMapCache(String name, Codec codec)Returns transactional map-based cache instance bynameusing providedcodecfor both cache keys and values.List<TransactionalOperation>getOperations()<V> RSet<V>getSet(String name)Returns transactional set instance by name.<V> RSet<V>getSet(String name, Codec codec)Returns transactional set instance by name using provided codec for set objects.<V> RSetCache<V>getSetCache(String name)Returns transactional set-based cache instance byname.<V> RSetCache<V>getSetCache(String name, Codec codec)Returns transactional set-based cache instance byname.voidrollback()Rollback all changes made on this transaction.voidrollback(List<TransactionalOperation> operations)RFuture<Void>rollbackAsync()Rollback all changes made on this transaction in async mode.
-
-
-
Constructor Detail
-
RedissonTransaction
public RedissonTransaction(CommandAsyncExecutor commandExecutor, TransactionOptions options)
-
RedissonTransaction
public RedissonTransaction(CommandAsyncExecutor commandExecutor, TransactionOptions options, List<TransactionalOperation> operations, Set<String> localCaches)
-
-
Method Detail
-
getLocalCachedMap
public <K,V> RLocalCachedMap<K,V> getLocalCachedMap(RLocalCachedMap<K,V> fromInstance)
Description copied from interface:RTransactionReturns transactional local cached map proxy for specified local cached map instance.- Specified by:
getLocalCachedMapin interfaceRTransaction- Type Parameters:
K- type of keyV- type of value- Parameters:
fromInstance- - local cache map instance- Returns:
- LocalCachedMap object
-
getBucket
public <V> RBucket<V> getBucket(String name)
Description copied from interface:RTransactionReturns transactional object holder instance by name.- Specified by:
getBucketin interfaceRTransaction- Type Parameters:
V- type of value- Parameters:
name- - name of object- Returns:
- Bucket object
-
getBucket
public <V> RBucket<V> getBucket(String name, Codec codec)
Description copied from interface:RTransactionReturns transactional object holder instance by name using provided codec for object.- Specified by:
getBucketin interfaceRTransaction- Type Parameters:
V- type of value- Parameters:
name- - name of objectcodec- - codec for values- Returns:
- Bucket object
-
getBuckets
public RBuckets getBuckets()
Description copied from interface:RTransactionReturns transactional interface for mass operations with Bucket objects.- Specified by:
getBucketsin interfaceRTransaction- Returns:
- Buckets
-
getBuckets
public RBuckets getBuckets(Codec codec)
Description copied from interface:RTransactionReturns transactional interface for mass operations with Bucket objects using provided codec for object.- Specified by:
getBucketsin interfaceRTransaction- Parameters:
codec- - codec for bucket objects- Returns:
- Buckets
-
getSet
public <V> RSet<V> getSet(String name)
Description copied from interface:RTransactionReturns transactional set instance by name.- Specified by:
getSetin interfaceRTransaction- Type Parameters:
V- type of value- Parameters:
name- - name of object- Returns:
- Set object
-
getSet
public <V> RSet<V> getSet(String name, Codec codec)
Description copied from interface:RTransactionReturns transactional set instance by name using provided codec for set objects.- Specified by:
getSetin interfaceRTransaction- Type Parameters:
V- type of value- Parameters:
name- - name of objectcodec- - codec for values- Returns:
- Set object
-
getSetCache
public <V> RSetCache<V> getSetCache(String name)
Description copied from interface:RTransactionReturns transactional set-based cache instance byname. Supports value eviction with a given TTL value.If eviction is not required then it's better to use regular map
RTransaction.getSet(String).- Specified by:
getSetCachein interfaceRTransaction- Type Parameters:
V- type of value- Parameters:
name- - name of object- Returns:
- SetCache object
-
getSetCache
public <V> RSetCache<V> getSetCache(String name, Codec codec)
Description copied from interface:RTransactionReturns transactional set-based cache instance byname. Supports value eviction with a given TTL value.If eviction is not required then it's better to use regular map
RTransaction.getSet(String, Codec).- Specified by:
getSetCachein interfaceRTransaction- Type Parameters:
V- type of value- Parameters:
name- - name of objectcodec- - codec for values- Returns:
- SetCache object
-
getMap
public <K,V> RMap<K,V> getMap(String name)
Description copied from interface:RTransactionReturns transactional map instance by name.- Specified by:
getMapin interfaceRTransaction- Type Parameters:
K- type of keyV- type of value- Parameters:
name- - name of object- Returns:
- Map object
-
getMap
public <K,V> RMap<K,V> getMap(String name, Codec codec)
Description copied from interface:RTransactionReturns transactional map instance by name using provided codec for both map keys and values.- Specified by:
getMapin interfaceRTransaction- Type Parameters:
K- type of keyV- type of value- Parameters:
name- - name of objectcodec- - codec for keys and values- Returns:
- Map object
-
getMapCache
public <K,V> RMapCache<K,V> getMapCache(String name)
Description copied from interface:RTransactionReturns transactional map-based cache instance by name. Supports entry eviction with a given MaxIdleTime and TTL settings.If eviction is not required then it's better to use regular map
RTransaction.getMap(String).- Specified by:
getMapCachein interfaceRTransaction- Type Parameters:
K- type of keyV- type of value- Parameters:
name- - name of object- Returns:
- MapCache object
-
getMapCache
public <K,V> RMapCache<K,V> getMapCache(String name, Codec codec)
Description copied from interface:RTransactionReturns transactional map-based cache instance bynameusing providedcodecfor both cache keys and values. Supports entry eviction with a given MaxIdleTime and TTL settings.If eviction is not required then it's better to use regular map
RTransaction.getMap(String, Codec).- Specified by:
getMapCachein interfaceRTransaction- Type Parameters:
K- type of keyV- type of value- Parameters:
name- - object namecodec- - codec for keys and values- Returns:
- MapCache object
-
commitAsync
public RFuture<Void> commitAsync()
Description copied from interface:RTransactionCommits all changes made on this transaction in async mode.- Specified by:
commitAsyncin interfaceRTransaction- Returns:
- void
-
commit
public void commit()
Description copied from interface:RTransactionCommits all changes made on this transaction.- Specified by:
commitin interfaceRTransaction
-
commit
public void commit(Set<String> localCaches, List<TransactionalOperation> operations)
-
generateId
protected static String generateId()
-
rollback
public void rollback()
Description copied from interface:RTransactionRollback all changes made on this transaction.- Specified by:
rollbackin interfaceRTransaction
-
rollback
public void rollback(List<TransactionalOperation> operations)
-
rollbackAsync
public RFuture<Void> rollbackAsync()
Description copied from interface:RTransactionRollback all changes made on this transaction in async mode.- Specified by:
rollbackAsyncin interfaceRTransaction- Returns:
- void
-
getOperations
public List<TransactionalOperation> getOperations()
-
checkState
protected void checkState()
-
-