Package com.github.ddth.dlock.impl.redis
Class BaseRedisDLockFactory
- java.lang.Object
-
- com.github.ddth.dlock.impl.AbstractDLockFactory
-
- com.github.ddth.dlock.impl.redis.BaseRedisDLockFactory
-
- All Implemented Interfaces:
IDLockFactory,AutoCloseable
- Direct Known Subclasses:
ClusteredRedisDLockFactory,RedisDLockFactory
public abstract class BaseRedisDLockFactory extends AbstractDLockFactory
Base class for Redis-based implementations ofIDLockFactory.- Since:
- 0.1.0
- Author:
- Thanh Ba Nguyen
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanmyOwnRedisFlag to mark if the Redis resource (e.g.
-
Constructor Summary
Constructors Constructor Description BaseRedisDLockFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract com.github.ddth.commons.redis.JedisConnectorbuildJedisConnector()Build aJedisConnectorinstance for my own use.BaseRedisDLockcreateLock(String name)Create a new lock.voiddestroy()protected com.github.ddth.commons.redis.JedisConnectorgetJedisConnector()StringgetRedisPassword()Password to connect to Redis server/cluster.BaseRedisDLockFactoryinit()BaseRedisDLockFactorysetJedisConnector(com.github.ddth.commons.redis.JedisConnector jedisConnector)BaseRedisDLockFactorysetRedisPassword(String redisPassword)Password to connect to Redis server/cluster.-
Methods inherited from class com.github.ddth.dlock.impl.AbstractDLockFactory
buildLockName, close, createAndInitLockInstance, createLockInternal, getLockNamePrefix, getLockProperties, getLockPropertiesMap, setLockNamePrefix, setLockProperties
-
-
-
-
Method Detail
-
getRedisPassword
public String getRedisPassword()
Password to connect to Redis server/cluster.- Returns:
-
setRedisPassword
public BaseRedisDLockFactory setRedisPassword(String redisPassword)
Password to connect to Redis server/cluster.- Parameters:
redisPassword-- Returns:
-
getJedisConnector
protected com.github.ddth.commons.redis.JedisConnector getJedisConnector()
- Returns:
-
setJedisConnector
public BaseRedisDLockFactory setJedisConnector(com.github.ddth.commons.redis.JedisConnector jedisConnector)
- Parameters:
jedisConnector-- Returns:
-
buildJedisConnector
protected abstract com.github.ddth.commons.redis.JedisConnector buildJedisConnector()
Build aJedisConnectorinstance for my own use.- Returns:
- Since:
- 0.1.1.2
-
init
public BaseRedisDLockFactory init()
- Overrides:
initin classAbstractDLockFactory- Since:
- 0.1.1.2
-
destroy
public void destroy()
- Overrides:
destroyin classAbstractDLockFactory
-
createLock
public BaseRedisDLock createLock(String name)
Create a new lock.- Specified by:
createLockin interfaceIDLockFactory- Overrides:
createLockin classAbstractDLockFactory- Returns:
- Since:
- 0.1.2
-
-