Skip to content

Commit 760c966

Browse files
committed
version 0.7.0.0 update
完善读写锁,现在fair自定义属性可以只写在一处
1 parent 4431155 commit 760c966

13 files changed

Lines changed: 337 additions & 399 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,7 @@
6767
<tr>
6868
<td>0.6.0.0</td><td>完善读写锁,现在可以自定义公平非公平</td><td>2022年2月2日</td>
6969
</tr>
70+
<tr>
71+
<td>0.7.0.0</td><td>完善读写锁,现在fair自定义属性可以只写在一处</td><td>2022年2月3日</td>
72+
</tr>
7073
</table>
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package org.springframework.lock.annotation;
22

3+
import org.springframework.lock.enumeration.BooleanEnum;
4+
35
import java.lang.annotation.*;
46

7+
import static org.springframework.lock.enumeration.BooleanEnum.*;
8+
59
/**
610
* 读锁
711
*/
@@ -11,8 +15,8 @@
1115
public @interface ReadLock {
1216

1317
/**
14-
* 是否是公平锁
15-
* @return 默认非公平
18+
* 是否公平锁
19+
* @return 默认null,如果有自定义值则覆盖默认值
1620
*/
17-
boolean fair() default false;
21+
BooleanEnum fair() default NULL;
1822
}
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package org.springframework.lock.annotation;
22

3+
import org.springframework.lock.enumeration.BooleanEnum;
4+
35
import java.lang.annotation.*;
46

7+
import static org.springframework.lock.enumeration.BooleanEnum.*;
8+
59
/**
610
* 写锁
711
*/
@@ -11,8 +15,8 @@
1115
public @interface WriteLock {
1216

1317
/**
14-
* 是否是公平锁
15-
* @return 默认非公平锁
18+
* 是否公平锁
19+
* @return 默认null,如果有自定义值则覆盖默认值
1620
*/
17-
boolean fair() default false;
21+
BooleanEnum fair() default NULL;
1822
}

src/main/java/org/springframework/lock/annotation/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
* 每个注解上都有对应的注释,写得很清楚,自己看就可以了,不加以赘述.
44
* 需要注意的是,如果需要使锁注解生效,需要在springboot启动类上添加{@code @EnableSpringLocks}注解
55
* @author 宗祥瑞
6-
* @version 0.6.0.0
6+
* @version 0.7.0.0
77
*/
88
package org.springframework.lock.annotation;

src/main/java/org/springframework/lock/aspect/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
* 每个切面都有注释,没什么好说的,不加以赘述.
44
* 切面这部分需要托管到spring容器中去执行.
55
* @author 宗祥瑞
6-
* @version 0.6.0.0
6+
* @version 0.7.0.0
77
*/
88
package org.springframework.lock.aspect;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package org.springframework.lock.enumeration;
2+
3+
/**
4+
* 适用于boolean的枚举类型
5+
*/
6+
public enum BooleanEnum {
7+
/**
8+
* 枚举值
9+
*/
10+
TRUE(Boolean.TRUE),
11+
FALSE(Boolean.FALSE),
12+
NULL(null)
13+
;
14+
15+
/**
16+
* 每个注解对应的真实值
17+
*/
18+
private Boolean value = null;
19+
20+
/**
21+
* 构造方法
22+
* @param value 每个注解对应的真实值
23+
*/
24+
private BooleanEnum(Boolean value) {
25+
this.value = value;
26+
}
27+
28+
/**
29+
* 获取枚举真实值
30+
* @return 枚举真实值
31+
*/
32+
public Boolean getValue() {
33+
return value;
34+
}
35+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* 这是关于枚举类型的包.
3+
* 写得很清楚,直接看代码就好了.
4+
* @version 0.7.0.0
5+
* @author 宗祥瑞
6+
*/
7+
package org.springframework.lock.enumeration;

src/main/java/org/springframework/lock/processor/ReadLockProcessor.java

Lines changed: 0 additions & 194 deletions
This file was deleted.

0 commit comments

Comments
 (0)