Interface ReactiveDistributedLock


  • public interface ReactiveDistributedLock
    A distributed lock with reactive api.
    See Also:
    ReactiveSherlock
    • Method Detail

      • getId

        java.lang.String getId()
        Return the lock id.
        Returns:
        the lock id
      • acquire

        java.util.concurrent.Flow.Publisher<AcquireResult> acquire()
        Try to acquire the lock. Lock is acquired for a pre configured duration.
        Returns:
        AcquireResult.SUCCESS if lock is acquired
      • acquire

        java.util.concurrent.Flow.Publisher<AcquireResult> acquire​(java.time.Duration duration)
        Try to acquire the lock for a given duration.
        Parameters:
        duration - how much time must pass for the acquired lock to expire
        Returns:
        AcquireResult.SUCCESS if lock is acquired
      • acquireForever

        java.util.concurrent.Flow.Publisher<AcquireResult> acquireForever()
        Try to acquire the lock without expiring date.

        It is potentially dangerous. Lookout for a situation when the lock owning instance goes down with out releasing the lock.

        Returns:
        AcquireResult.SUCCESS if lock is acquired