![JAR search and dependency download from the Maven repository](/logo.png)
com.github.andyshao.lock.DistributionLock Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Gear Show documentation
Show all versions of Gear Show documentation
Enhance and formating the coding of JDK
The newest version!
package com.github.andyshao.lock;
/**
*
* Title: Distribution lock
* Description:
* Copyright: Copyright(c) 18 Apr 2017
* Encoding:UNIX UTF-8
* @author Andy.Shao
*
*/
public interface DistributionLock {
/**
* unlock operation
*/
void unlock();
/**
* lock operation
*/
void lock();
/**
* lock with the time expire
* @param mode the expired mode
* @param times time value
*/
void lock(ExpireMode mode, int times);
/**
* lock operation
* @throws InterruptedException interrupted operation
*/
void lockInterruptibly() throws InterruptedException;
/**
* lock with the expired time
* @param mode expire mode
* @param times time value
* @throws InterruptedException interrupted operation
*/
void lockInterruptibly(ExpireMode mode, int times) throws InterruptedException;
/**
* try to take a lock
* @return if the lock has been taken then true
*/
boolean tryLock();
/**
* try to take a lock
* @param mode expired mode
* @param times time value
* @return if the lock has been taken then true
*/
boolean tryLock(ExpireMode mode, int times);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy