[Feature] add for new

This commit is contained in:
binbin.hou
2020-09-10 11:19:54 +08:00
parent 0509780502
commit 3a8c68a19d
17 changed files with 318 additions and 145 deletions

View File

@@ -1,5 +1,6 @@
package com.github.houbb.lock.api.core;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
/**
@@ -8,4 +9,32 @@ import java.util.concurrent.locks.Lock;
* @since 0.0.1
*/
public interface ILock extends Lock {
/**
* 尝试加锁
* @param time 时间
* @param unit 当为
* @param key key
* @return 返回
* @throws InterruptedException 异常
* @since 0.0.1
*/
boolean tryLock(long time, TimeUnit unit,
String key) throws InterruptedException;
/**
* 尝试加锁
* @param key key
* @return 返回
* @since 0.0.1
*/
boolean tryLock(String key);
/**
* 解锁
* @param key key
* @since 0.0.1
*/
void unlock(String key);
}