Class R2dbcLockProvider
java.lang.Object
net.javacrumbs.shedlock.support.StorageBasedLockProvider
net.javacrumbs.shedlock.provider.r2dbc.R2dbcLockProvider
- All Implemented Interfaces:
net.javacrumbs.shedlock.core.ExtensibleLockProvider,net.javacrumbs.shedlock.core.LockProvider
public class R2dbcLockProvider
extends net.javacrumbs.shedlock.support.StorageBasedLockProvider
Lock provided by plain R2DBC SPI. It uses a table that contains lock_name and
locked_until.
- Attempts to insert a new lock record. Since lock name is a primary key, it fails if the record already exists. As an optimization, we keep in-memory track of created lock records.
- If the insert succeeds (1 inserted row) we have the lock.
- If the insert failed due to duplicate key or we have skipped the insertion, we will try to update lock record using UPDATE tableName SET lock_until = :lockUntil WHERE name = :lockName AND lock_until <= :now
- If the update succeeded (1 updated row), we have the lock. If the update failed (0 updated rows) somebody else holds the lock
- When unlocking, lock_until is set to now.
-
Constructor Summary
ConstructorsConstructorDescriptionR2dbcLockProvider(io.r2dbc.spi.ConnectionFactory connectionFactory) R2dbcLockProvider(io.r2dbc.spi.ConnectionFactory connectionFactory, String tableName) -
Method Summary
Methods inherited from class net.javacrumbs.shedlock.support.StorageBasedLockProvider
clearCache, doLock, lock
-
Constructor Details
-
R2dbcLockProvider
public R2dbcLockProvider(io.r2dbc.spi.ConnectionFactory connectionFactory) -
R2dbcLockProvider
-