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

shz.core.lock.LockHolder Maven / Gradle / Ivy

There is a newer version: 2024.0.2
Show newest version
package shz.core.lock;

import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;

public interface LockHolder {
     R applyRead(Supplier supplier, long time, TimeUnit unit);

    default  R applyRead(Supplier supplier) {
        return applyRead(supplier, 0L, TimeUnit.MILLISECONDS);
    }

    void acceptRead(Runnable runnable, long time, TimeUnit unit);

    default void acceptRead(Runnable runnable) {
        acceptRead(runnable, 0L, TimeUnit.MILLISECONDS);
    }

     R applyWrite(Supplier supplier, long time, TimeUnit unit);

    default  R applyWrite(Supplier supplier) {
        return applyWrite(supplier, 0L, TimeUnit.MILLISECONDS);
    }

    void acceptWrite(Runnable runnable, long time, TimeUnit unit);

    default void acceptWrite(Runnable runnable) {
        acceptWrite(runnable, 0L, TimeUnit.MILLISECONDS);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy