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 void
checkState()
void
commit()
Commits all changes made on this transaction.void
commit(Set<String> localCaches, List<TransactionalOperation> operations)
RFuture<Void>
commitAsync()
Commits all changes made on this transaction in async mode.protected static String
generateId()
<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.<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 byname
using providedcodec
for 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
.void
rollback()
Rollback all changes made on this transaction.void
rollback(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:RTransaction
Returns transactional local cached map proxy for specified local cached map instance.- Specified by:
getLocalCachedMap
in 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:RTransaction
Returns transactional object holder instance by name.- Specified by:
getBucket
in 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:RTransaction
Returns transactional object holder instance by name using provided codec for object.- Specified by:
getBucket
in interfaceRTransaction
- Type Parameters:
V
- type of value- Parameters:
name
- - name of objectcodec
- - codec for values- Returns:
- Bucket object
-
getSet
public <V> RSet<V> getSet(String name)
Description copied from interface:RTransaction
Returns transactional set instance by name.- Specified by:
getSet
in 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:RTransaction
Returns transactional set instance by name using provided codec for set objects.- Specified by:
getSet
in 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:RTransaction
Returns 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:
getSetCache
in 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:RTransaction
Returns 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:
getSetCache
in 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:RTransaction
Returns transactional map instance by name.- Specified by:
getMap
in 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:RTransaction
Returns transactional map instance by name using provided codec for both map keys and values.- Specified by:
getMap
in 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:RTransaction
Returns 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:
getMapCache
in 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:RTransaction
Returns transactional map-based cache instance byname
using providedcodec
for 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:
getMapCache
in 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:RTransaction
Commits all changes made on this transaction in async mode.- Specified by:
commitAsync
in interfaceRTransaction
- Returns:
- void
-
commit
public void commit()
Description copied from interface:RTransaction
Commits all changes made on this transaction.- Specified by:
commit
in interfaceRTransaction
-
commit
public void commit(Set<String> localCaches, List<TransactionalOperation> operations)
-
generateId
protected static String generateId()
-
rollback
public void rollback()
Description copied from interface:RTransaction
Rollback all changes made on this transaction.- Specified by:
rollback
in interfaceRTransaction
-
rollback
public void rollback(List<TransactionalOperation> operations)
-
rollbackAsync
public RFuture<Void> rollbackAsync()
Description copied from interface:RTransaction
Rollback all changes made on this transaction in async mode.- Specified by:
rollbackAsync
in interfaceRTransaction
- Returns:
- void
-
getOperations
public List<TransactionalOperation> getOperations()
-
checkState
protected void checkState()
-
-