release branch 0.0.1
This commit is contained in:
41
README.md
41
README.md
@@ -31,7 +31,46 @@ maven 3.x+
|
|||||||
```xml
|
```xml
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.houbb</groupId>
|
<groupId>com.github.houbb</groupId>
|
||||||
<artifactId>lock</artifactId>
|
<artifactId>lock-core</artifactId>
|
||||||
<version>${最新版本}</version>
|
<version>${最新版本}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 入门例子
|
||||||
|
|
||||||
|
基于本地 redis 的测试案例。
|
||||||
|
|
||||||
|
```java
|
||||||
|
Jedis jedis = new Jedis("127.0.0.1", 6379);
|
||||||
|
IOperator operator = new JedisOperator(jedis);
|
||||||
|
|
||||||
|
// 获取锁
|
||||||
|
ILock lock = LockRedisBs.newInstance().operator(operator).lock();
|
||||||
|
|
||||||
|
try {
|
||||||
|
boolean lockResult = lock.tryLock();
|
||||||
|
System.out.println(lockResult);
|
||||||
|
// 业务处理
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
# 后期 Road-MAP
|
||||||
|
|
||||||
|
- [ ] 支持锁的可重入
|
||||||
|
|
||||||
|
持有锁的线程可以多次获取锁
|
||||||
|
|
||||||
|
- [ ] redis 实现的支持
|
||||||
|
|
||||||
|
cluster 支持
|
||||||
|
|
||||||
|
redis 支持
|
||||||
|
|
||||||
|
aliyun-redis 支持
|
||||||
|
|
||||||
|
各种各样的声明方式的默认支持
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>lock</artifactId>
|
<artifactId>lock</artifactId>
|
||||||
<groupId>com.github.houbb</groupId>
|
<groupId>com.github.houbb</groupId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>lock</artifactId>
|
<artifactId>lock</artifactId>
|
||||||
<groupId>com.github.houbb</groupId>
|
<groupId>com.github.houbb</groupId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>lock-redis</artifactId>
|
<artifactId>lock-core</artifactId>
|
||||||
<description>The lock depends on redis.</description>
|
<description>The core lock implements.</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!--============================== SELF ==============================-->
|
<!--============================== SELF ==============================-->
|
||||||
|
|||||||
26
lock-test/pom.xml
Normal file
26
lock-test/pom.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>lock</artifactId>
|
||||||
|
<groupId>com.github.houbb</groupId>
|
||||||
|
<version>0.0.1</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>lock-test</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.houbb</groupId>
|
||||||
|
<artifactId>lock-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.github.houbb.lock.test;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import redis.clients.jedis.Jedis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author binbin.hou
|
||||||
|
* @since 0.0.1
|
||||||
|
*/
|
||||||
|
public class JedisTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void helloTest() {
|
||||||
|
Jedis jedis = new Jedis("127.0.0.1", 6379);
|
||||||
|
jedis.set("key", "001");
|
||||||
|
String value = jedis.get("key");
|
||||||
|
|
||||||
|
Assert.assertEquals("001", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.github.houbb.lock.test;
|
||||||
|
|
||||||
|
import com.github.houbb.lock.api.core.ILock;
|
||||||
|
import com.github.houbb.lock.redis.bs.LockRedisBs;
|
||||||
|
import com.github.houbb.lock.redis.support.operator.IOperator;
|
||||||
|
import com.github.houbb.lock.redis.support.operator.impl.JedisOperator;
|
||||||
|
import org.junit.Test;
|
||||||
|
import redis.clients.jedis.Jedis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author binbin.hou
|
||||||
|
* @since 0.0.1
|
||||||
|
*/
|
||||||
|
public class RedisLockTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void helloTest() {
|
||||||
|
Jedis jedis = new Jedis("127.0.0.1", 6379);
|
||||||
|
IOperator operator = new JedisOperator(jedis);
|
||||||
|
|
||||||
|
// 获取锁
|
||||||
|
ILock lock = LockRedisBs.newInstance().operator(operator).lock();
|
||||||
|
|
||||||
|
try {
|
||||||
|
boolean lockResult = lock.tryLock();
|
||||||
|
System.out.println(lockResult);
|
||||||
|
// 业务处理
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
package com.github.houbb.lock.test;
|
||||||
5
pom.xml
5
pom.xml
@@ -5,10 +5,11 @@
|
|||||||
<groupId>com.github.houbb</groupId>
|
<groupId>com.github.houbb</groupId>
|
||||||
<artifactId>lock</artifactId>
|
<artifactId>lock</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>lock-api</module>
|
<module>lock-api</module>
|
||||||
<module>lock-core</module>
|
<module>lock-core</module>
|
||||||
|
<module>lock-test</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -51,7 +52,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.houbb</groupId>
|
<groupId>com.github.houbb</groupId>
|
||||||
<artifactId>lock-redis</artifactId>
|
<artifactId>lock-core</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ ECHO "============================= RELEASE START..."
|
|||||||
|
|
||||||
:: 版本号信息(需要手动指定)
|
:: 版本号信息(需要手动指定)
|
||||||
:::: 旧版本名称
|
:::: 旧版本名称
|
||||||
SET version=0.1.112
|
SET version=0.0.1
|
||||||
:::: 新版本名称
|
:::: 新版本名称
|
||||||
SET newVersion=0.1.113
|
SET newVersion=0.0.2
|
||||||
:::: 组织名称
|
:::: 组织名称
|
||||||
SET groupName=com.github.houbb
|
SET groupName=com.github.houbb
|
||||||
:::: 项目名称
|
:::: 项目名称
|
||||||
|
|||||||
Reference in New Issue
Block a user