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

top.netkit.redis.client.executor.RedisLockExecutor Maven / Gradle / Ivy

The newest version!
package top.netkit.redis.client.executor;

import org.redisson.api.RFuture;
import org.redisson.api.RLock;

import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;

/**
 * redis lock
 *
 * @author shixinke
 */
public interface RedisLockExecutor {

    /**
     * normal lock
     * @param key lock key
     * @param timeout lock timeout
     * @param timeUnit time unit
     * @param executor business executor
     * @return boolean
     */
     T lock(String key, int timeout, TimeUnit timeUnit, ReturnableExecutor executor);

    /**
     * normal lock without result
     * @param key lock key
     * @param timeout wait timeout
     * @param timeUnit time unit
     * @param executor business executor
     */
    void lock(String key, int timeout, TimeUnit timeUnit, VoidExecutor executor);

    /**
     * normal lock
     * @param key lock key
     * @param fair is fair lock
     * @param timeout lock timeout
     * @param timeUnit time unit
     * @param executor business executor
     * @return boolean
     */
     T lock(String key, boolean fair, int timeout, TimeUnit timeUnit, ReturnableExecutor executor);

    /**
     * normal lock without result
     * @param key lock key
     * @param fair is fair lock
     * @param timeout lock timeout
     * @param timeUnit time unit
     * @param executor business executor
     */
    void lock(String key, boolean fair, int timeout, TimeUnit timeUnit, VoidExecutor executor);

    /**
     * normal lock
     * @param key lock key
     * @param timeout lock timeout
     * @param executor business executor
     * @return boolean
     */
     T lock(String key, int timeout, ReturnableExecutor executor);

    /**
     * normal lock without result
     * @param key lock key
     * @param timeout lock timeout
     * @param executor business executor
     */
    void lock(String key, int timeout, VoidExecutor executor);

    /**
     * normal lock
     * @param key lock key
     * @param waitTime wait time
     * @param releaseTime release time
     * @param timeUnit time unit
     * @param executor business executor
     * @return boolean
     */
     T tryLock(String key, int waitTime, int releaseTime,  TimeUnit timeUnit, ReturnableExecutor executor);

    /**
     * normal lock without result
     * @param key lock key
     * @param waitTime wait time
     * @param releaseTime release time
     * @param timeUnit time unit
     * @param executor business executor
     */
    void tryLock(String key, int waitTime, int releaseTime, TimeUnit timeUnit, VoidExecutor executor);



    /**
     * normal lock
     * @param key lock key
     * @param waitTime wait time
     * @param releaseTime release time
     * @param executor business executor
     * @return boolean
     */
     T tryLock(String key, int waitTime, int releaseTime,  ReturnableExecutor executor);

    /**
     * normal lock without result
     * @param key lock key
     * @param waitTime wait time
     * @param releaseTime release time
     * @param executor business executor
     */
    void tryLock(String key, int waitTime, int releaseTime, VoidExecutor executor);

    /**
     * get read lock
     * @param key lock key
     * @param readTimeout lock timeout
     * @param writeTimeout write timeout
     * @param readExecutor business executor when get read lock
     * @param writeExecutor business executor when get write lock
     * @return boolean
     */
     T readWriteLock(String key, int readTimeout, int writeTimeout, ReturnableExecutor readExecutor, ReturnableExecutor writeExecutor);


    /**
     * multi lock
     * @param keys lock keys
     * @param timeout timeout
     * @param timeUnit time unit
     * @param executor business executor
     * @return T
     */
     T multiLock(List keys, int timeout, TimeUnit timeUnit, ReturnableExecutor executor);

    /**
     * multi lock
     * @param keys lock keys
     * @param timeout timeout
     * @param executor business executor
     * @return T
     */
     T multiLock(List keys, int timeout, ReturnableExecutor executor);



    /**
     * multi lock
     * @param keys lock keys
     * @param timeout timeout
     * @param timeUnit time unit
     * @param executor business executor
     */
    void multiLock(List keys, int timeout, TimeUnit timeUnit, VoidExecutor executor);

    /**
     * multi lock
     * @param keys lock keys
     * @param timeout timeout
     * @param executor business executor
     */
    void multiLock(List keys, int timeout, VoidExecutor executor);



}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy