@Transactional public class DefaultLockRepository extends Object implements LockRepository, org.springframework.beans.factory.InitializingBean
LockRepository based on the
table from the script presented in the org/springframework/integration/jdbc/schema-*.sql.
This repository can't be shared between different JdbcLockRegistry instances.
Otherwise it opens a possibility to break Lock contract,
where JdbcLockRegistry uses non-shared ReentrantLocks
for local synchronizations.
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DEFAULT_TABLE_NAME
Default value for the table prefix property.
|
static int |
DEFAULT_TTL
Default value for the time-to-live property.
|
| 构造器和说明 |
|---|
DefaultLockRepository(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
acquire(String lock) |
void |
afterPropertiesSet() |
void |
close() |
void |
delete(String lock) |
boolean |
isAcquired(String lock) |
void |
setRegion(String region)
A unique grouping identifier for all locks persisted with this store.
|
void |
setTableName(String tableName) |
void |
setTimeToLive(int timeToLive)
Specify the time (in milliseconds) to expire dead locks.
|
public static final String DEFAULT_TABLE_NAME
public static final int DEFAULT_TTL
public DefaultLockRepository(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
public void setRegion(String region)
DEFAULT.region - the region name to setpublic void setTableName(String tableName)
public void setTimeToLive(int timeToLive)
timeToLive - the time to expire dead locks.public void afterPropertiesSet()
throws SQLException
afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBeanSQLExceptionpublic void close()
close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在接口中 LockRepositorypublic void delete(String lock)
delete 在接口中 LockRepository@Transactional(isolation=SERIALIZABLE,
timeout=1)
public boolean acquire(String lock)
acquire 在接口中 LockRepositorypublic boolean isAcquired(String lock)
isAcquired 在接口中 LockRepositoryCopyright © 2018 Pivotal Software, Inc.. All rights reserved.