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

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

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

import lombok.Getter;

import java.util.concurrent.TimeUnit;

/**
 * 获取 lock失败
 *
 * @author JustryDeng 
 * @since 2100.9.8
 */
@Getter
public class NotAcquiredLockException extends RuntimeException {
    
    /**
     * 锁 key
     */
    private final String lockKey;
    
    /**
     * 等待获取锁的最大时长
     */
    private final long waitTime;
    
    /**
     * waitTime的时间单位
     */
    private final TimeUnit timeUnit;
    
    public NotAcquiredLockException(String lockKey, long waitTime, TimeUnit timeUnit) {
        super(String.format("lockKey=%s, waitTime=%d, timeUnit=%s", lockKey, waitTime, timeUnit));
        this.lockKey = lockKey;
        this.waitTime = waitTime;
        this.timeUnit = timeUnit;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy