io.github.dengchen2020.lock.api.DLock Maven / Gradle / Ivy
package io.github.dengchen2020.lock.api;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
/**
* 锁的简单接口
* @author dengchen
* @since 2024/7/3
*/
public interface DLock {
void tryLockAndRun(String key, Runnable runnable) throws InterruptedException;
void tryLockAndRun(String key, long waitTime, TimeUnit unit, Runnable runnable) throws InterruptedException;
T tryLockAndRun(String key, Callable callable) throws Exception;
T tryLockAndRun(String key, long waitTime, TimeUnit unit, Callable callable) throws Exception;
}