Adds functionality to HotswapRefConstructor to check whether input I
has changed and only if it has, swap
the current value of R
with a new cats.effect.kernel.Resource.
Adds functionality to HotswapRefConstructor to check whether input I
has changed and only if it has, swap
the current value of R
with a new cats.effect.kernel.Resource.
- Companion
- object
Value members
Concrete methods
Conditionally swap R
using I
. If next
matches the current value of I
then do not swap.
Conditionally swap R
using I
. If next
matches the current value of I
then do not swap.
Use swapWith to force reinitialization of R
.
Note that the reference to I
is relinquished before swapWith is called, so that we don't get blocked.
- Returns
boolean result of conditional swap,
true
ifR
has been swappedfalse
if it has not been swapped.
Inherited methods
Access R
safely
Access R
safely
Note that access to R
is protected by a shared-mode lock via a cats.effect.kernel.Resource scope.
A resource R
with unreleased locks cannot be finalized and therefore cannot be fully swapped.
- Inherited from
- HotswapRef
Access the current input value I
on its own
Access the current input value I
on its own
- Inherited from
- HotswapRefConstructor
Access the current resource value R
on its own
Access the current resource value R
on its own
- Inherited from
- HotswapRefConstructor
Swap the current resource with a new version
Swap the current resource with a new version
This makes use of evalTap
on the provided cats.effect.kernel.Resource to ensure the
cats.effect.kernel.Ref with R
is updated immediately on allocation and may be used by access calls while
swap blocks, waiting for the previous cats.effect.kernel.Resource to finalize.
This means that while there is no previous finalization process in progress when this is called, R
may be
swapped in the holder ref, but will block until all references to R
are removed and R
is torn down.
A semaphore guarantees that concurrent access to swap will wait while previous resources are finalized.
- Inherited from
- HotswapRef
Swap R
using I
using some function of I
to cats.effect.kernel.Resource of R
, provided at construction
time
Swap R
using I
using some function of I
to cats.effect.kernel.Resource of R
, provided at construction
time
- Inherited from
- HotswapRefConstructor