All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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 {

    String LOCK_GLOBAL_PREFIX = "dc:lock:";

    void tryLockAndRun(String key, Runnable runnable);

    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;

    void lockAndRun(String key, Runnable runnable);

     T lockAndRun(String key, Callable callable) throws Exception;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy