代码拉取完成,页面将自动刷新
Distributed lock implementation using Redis and Zookeeper.(基于 Redis 和 Zookeeper 分布式锁实现)
Below is a simple demo. Talk is cheap. Show me the code.
If your're using Maven, just add the following dependency in pom.xml
.
<!-- replace here with the latest version -->
<dependency>
<groupId>com.github.xinlc</groupId>
<artifactId>lock4j-spring-boot-starter</artifactId>
<version>1.0.0</version>
</dependency>
If not, you can download JAR in Maven Center Repository.
@DistributedLockable(
prefix = "hello",
argNames = {"name"},
expireTime = 10,
unit = TimeUnit.SECONDS,
onFailure = HelloLockException.class
)
@GetMapping
public void hello(@RequestParam("name") String name) {
log.info("hello {}", name);
}
More examples.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。