release branch 0.0.1

This commit is contained in:
binbin.hou
2020-09-10 14:03:35 +08:00
parent 3a8c68a19d
commit 8efc7db9c7
9 changed files with 134 additions and 10 deletions

View File

@@ -31,7 +31,46 @@ maven 3.x+
```xml
<dependency>
<groupId>com.github.houbb</groupId>
<artifactId>lock</artifactId>
<artifactId>lock-core</artifactId>
<version>${最新版本}</version>
</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 支持
各种各样的声明方式的默认支持

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>lock</artifactId>
<groupId>com.github.houbb</groupId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -5,12 +5,12 @@
<parent>
<artifactId>lock</artifactId>
<groupId>com.github.houbb</groupId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>lock-redis</artifactId>
<description>The lock depends on redis.</description>
<artifactId>lock-core</artifactId>
<description>The core lock implements.</description>
<dependencies>
<!--============================== SELF ==============================-->

26
lock-test/pom.xml Normal file
View 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>

View File

@@ -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);
}
}

View File

@@ -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();
}
}
}

View File

@@ -0,0 +1 @@
package com.github.houbb.lock.test;

View File

@@ -5,10 +5,11 @@
<groupId>com.github.houbb</groupId>
<artifactId>lock</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
<modules>
<module>lock-api</module>
<module>lock-core</module>
<module>lock-test</module>
</modules>
<properties>
@@ -51,7 +52,7 @@
</dependency>
<dependency>
<groupId>com.github.houbb</groupId>
<artifactId>lock-redis</artifactId>
<artifactId>lock-core</artifactId>
<version>${project.version}</version>
</dependency>

View File

@@ -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
:::: 项目名称