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

com.ideaaedi.commonds.lock.LockSupport Maven / Gradle / Ivy

The newest version!
package com.ideaaedi.commonds.lock;

import com.ideaaedi.commonds.function.NoArgConsumer;
import com.ideaaedi.commonds.function.NoArgFunction;

import java.util.function.Consumer;
import java.util.function.Function;

/**
 * 分布式锁支持
 *
 * @author JustryDeng 
 * @since 2100.9.8
 */
public interface LockSupport {
    
    /**
     * 执行同步逻辑
     *
     * @param function 业务逻辑块
     * @param param 参数
     *
     * @return 逻辑执行结果
     *
     * @throws NotAcquiredLockException 获取分布式锁时抛出失败
     */
     R exec(Function function, P param) throws NotAcquiredLockException;
    
    /**
     * 执行同步逻辑
     *
     * @param function 业务逻辑块
     *
     * @return 执行结果
     *
     * @throws NotAcquiredLockException 获取分布式锁时抛出失败
     */
     R exec(NoArgFunction function) throws NotAcquiredLockException;
    
    /**
     * 执行同步逻辑
     *
     * @param consumer 业务逻辑块
     * @param param 参数
     *
     * @throws NotAcquiredLockException 获取分布式锁时抛出失败
     */
    

void voidExec(Consumer

consumer, P param) throws NotAcquiredLockException; /** * 执行同步逻辑 * * @param consumer 业务逻辑块 * * @throws NotAcquiredLockException 获取分布式锁时抛出失败 */ void voidExec(NoArgConsumer consumer) throws NotAcquiredLockException; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy