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

com.coditory.sherlock.rxjava.DistributedLockConnector Maven / Gradle / Ivy

The newest version!
package com.coditory.sherlock.rxjava;

import com.coditory.sherlock.LockRequest;
import com.coditory.sherlock.connector.AcquireResult;
import com.coditory.sherlock.connector.InitializationResult;
import com.coditory.sherlock.connector.ReleaseResult;
import io.reactivex.rxjava3.core.Single;
import org.jetbrains.annotations.NotNull;

public interface DistributedLockConnector {
    /**
     * Initializes underlying infrastructure for locks.
     * Most frequently triggers database table creation and index creation.
     * 

* If it is not executed explicitly, connector may execute it during first acquire acquisition or * release. */ @NotNull Single initialize(); /** * Acquire a lock. */ @NotNull Single acquire(@NotNull LockRequest lockRequest); /** * Acquire a lock or prolong it if it was acquired by the same instance. */ @NotNull Single acquireOrProlong(LockRequest lockRequest); /** * Acquire a lock even if it was already acquired by someone else */ @NotNull Single forceAcquire(@NotNull LockRequest lockRequest); /** * Unlock a lock if wat acquired by the same instance. */ @NotNull Single release(@NotNull String lockId, @NotNull String ownerId); /** * Release a lock without checking its owner or release date. */ @NotNull Single forceRelease(@NotNull String lockId); /** * Release all locks without checking their owners or release dates. */ @NotNull Single forceReleaseAll(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy