Mono into LockedMono.LockedMonoBuilder for uses with its fluent APILock by internally broadcasting releasing events.LockCancellationException to a subscriberSignalType.ON_COMPLETE signal to a subscriberSinks.Empty-like implementationMono.flatMap(Function) of the internal mono, with the lock heldLock.withLock(Supplier) to handle cancelling signals
Usage:
Lock lock = new ReactiveLock(); /* Or other locks */
mono
.flatMap(t -> lock.lock().thenReturn(t))
/* Some processing */
.transform(lock::unlockOnNext)
.block();
The underlying implementation should automatically queue the Mono up
if the lock is not available.
Do not use Mono.timeout(Duration) or Mono.timeout(Publisher),
which are not handled at all. Use Lock.tryLock(Duration) or Lock.tryLock() instead
if you want timeouts.
Mono-like API to build instructions in locked scopesMono to listen to and a canceller function).Lock.withLock(Supplier) to handle cancelling signals
Usage:
Lock lock = new ReactiveLock(); /* Or other locks */
mono
.transform(lock::lockOnNext)
/* Some processing */
.transform(lock::unlockOnNext)
.block();
The underlying implementation should automatically queue the Mono up
if the lock is not available.
When the lock becomes available, the value will be automatically propagated downstream.
Mono.map(Function) of the internal mono, with the lock heldMono that emits success only after acquiring the lockSinks.Empty, offer it to the queue, and make a Mono
which emits success after the sink is filled.CasLock with the given fairness policyRWLock.withRLock(Supplier) to handle cancelling signals
The difference is that the underlying implementation might choose to implement a Readers–writer lock.
Do not use Mono.timeout(Duration) or Mono.timeout(Publisher),
which are not handled at all. Use tryRLock(Duration) or tryRLock() instead
if you want timeouts.
withRLock(Supplier) to handle cancelling signals
The difference is that the underlying implementation might choose to implement a Readers–writer lock.
Lock.unlock() for details.withRLock(Supplier) to handle cancelling signalswithRLock(Supplier) to handle cancelling signalswithRLock(Supplier) to handle cancelling signalswithRLock(Supplier) to handle cancelling signalsLock.withLock(Supplier) to handle cancelling signalsLock.tryLock()Lock.withLock(Supplier) to handle cancelling signalsLock.withLock(Supplier) to handle cancelling signals
Usage:
Lock lock = new ReactiveLock(); /* Or other locks */
mono
.transform(lock::lockOnNext)
/* Some processing */
.transform(lock::unlockOnEmpty)
.block();
Using Mono.switchIfEmpty(Mono) to ensure the execution order and handling of
an empty Mono.
Lock.withLock(Supplier) to handle cancelling signals
Usage:
Lock lock = new ReactiveLock(); /* Or other locks */
mono
.transform(lock::lockOnNext)
/* Some processing */
.transform(lock::unlockOnError)
.block();
Using Mono.doOnError(Consumer) to ensure the execution order and handling of
Monos with an error.
Lock.withLock(Supplier) to handle cancelling signals
Usage:
Lock lock = new ReactiveLock(); /* Or other locks */
mono
.transform(lock::lockOnNext)
/* Some processing */
.transform(lock::unlockOnNext)
.block();
Using Mono.doOnNext(Consumer) to ensure the execution order and handling of
a successful Mono with a emitted value.
Lock.withLock(Supplier) to handle cancelling signals
Usage:
Lock lock = new ReactiveLock(); /* Or other locks */
mono
.transform(lock::lockOnNext)
/* Some processing */
.transform(lock::unlockOnTerminate)
.block();
Using Mono.doOnTerminate(Runnable) to ensure the execution order and handling of
all cases, including an empty Mono, a successful Mono with a
emitted value or Monos with an error.
Mono, with previous transformations
gathered into the lock scope with Lock.withLock(Supplier)Mono, with previous transformations
gathered into the lock scope with withRLock(Supplier)Lock.withLock(Supplier).