@Target(value=METHOD) @Retention(value=RUNTIME) @Documented @Component public @interface Lock
| 限定符和类型 | 可选元素和说明 |
|---|---|
String |
argName
锁的唯一名称
可以不需要配置,在对就的参数变量名中取值作为唯一编号,限制锁定时间内只能有一个线程运行
|
String |
errorMethodName
可以不需要配置,获取锁异常时需要执行的类方法名称
比如:java.lang.Object.wait(java.lang.Long)
|
String |
lockId
锁的唯一编号
可以不需要配置,根据唯一编号限制锁定时间内只能有一个线程运行
|
int |
timeout
执行访求的锁定时间
没有设置的情况下默认5秒的超时时间,在指定锁定时间内只能有一个线程运行
|
String |
timeOutMethodName
可以不需要配置,锁定时间内需要执行的类方法名称
比如:java.lang.Object.wait(java.lang.Long)
|
public abstract int timeout
public abstract String lockId
public abstract String argName
public abstract String timeOutMethodName
public abstract String errorMethodName
Copyright © 2018. All rights reserved.