com.github.xinlc:lock4j-core

The core of lock4j

License

License

GroupId

GroupId

com.github.xinlc
ArtifactId

ArtifactId

lock4j-core
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

The core of lock4j

Download lock4j-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.xinlc/lock4j-core/ -->
<dependency>
    <groupId>com.github.xinlc</groupId>
    <artifactId>lock4j-core</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.xinlc/lock4j-core/
implementation 'com.github.xinlc:lock4j-core:1.0.1'
// https://jarcasting.com/artifacts/com.github.xinlc/lock4j-core/
implementation ("com.github.xinlc:lock4j-core:1.0.1")
'com.github.xinlc:lock4j-core:jar:1.0.1'
<dependency org="com.github.xinlc" name="lock4j-core" rev="1.0.1">
  <artifact name="lock4j-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.xinlc', module='lock4j-core', version='1.0.1')
)
libraryDependencies += "com.github.xinlc" % "lock4j-core" % "1.0.1"
[com.github.xinlc/lock4j-core "1.0.1"]

Dependencies

compile (8)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-aop jar 2.2.5.RELEASE
org.springframework.boot : spring-boot-starter-data-redis jar 2.2.5.RELEASE
org.apache.commons : commons-pool2 jar 2.8.1
org.apache.commons : commons-lang3 jar 3.11
org.slf4j : slf4j-api jar 1.7.28
com.fasterxml.jackson.core : jackson-core jar 2.10.0
com.fasterxml.jackson.core : jackson-databind jar 2.10.0
com.fasterxml.jackson.core : jackson-annotations jar 2.10.0

Project Modules

There are no modules declared in this project.

Related Libraries

lock4j

Distributed lock implementation using Redis and Zookeeper.(基于 Redis 和 Zookeeper 分布式锁实现)

Quick Start

Below is a simple demo. Talk is cheap. Show me the code.

1. Add Dependency

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.1</version>
</dependency>

If not, you can download JAR in Maven Center Repository.

2. Define Controller

@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.

TODO

  • Zookeeper implementation.

Versions

Version
1.0.1
1.0.0