Class ElasticsearchLockProvider
java.lang.Object
net.javacrumbs.shedlock.provider.elasticsearch8.ElasticsearchLockProvider
- All Implemented Interfaces:
LockProvider
It uses a collection that contains documents like this:
{
"name" : "lock name",
"lockUntil" : {
"type": "date",
"format": "epoch_millis"
},
"lockedAt" : {
"type": "date",
"format": "epoch_millis"
}:
"lockedBy" : "hostname"
}
lockedAt and lockedBy are just for troubleshooting and are not read by the code
- Attempts to insert a new lock record. As an optimization, we keep in-memory track of created lock records. If the record has been inserted, returns lock.
- We will try to update lock record using filter _id == name AND lock_until <= now
- If the update succeeded (1 updated document), we have the lock. If the update failed (0 updated documents) somebody else holds the lock
- When unlocking, lock_until is set to now.
-
Constructor Summary
ConstructorsConstructorDescriptionElasticsearchLockProvider(co.elastic.clients.elasticsearch.ElasticsearchClient client) -
Method Summary
-
Constructor Details
-
ElasticsearchLockProvider
public ElasticsearchLockProvider(co.elastic.clients.elasticsearch.ElasticsearchClient client)
-
-
Method Details
-
lock
- Specified by:
lockin interfaceLockProvider
-