{"id":24294420,"url":"https://github.com/coditory/sherlock-distributed-lock","last_synced_at":"2025-09-25T20:31:28.602Z","repository":{"id":57718392,"uuid":"195197396","full_name":"coditory/sherlock-distributed-lock","owner":"coditory","description":"Distributed lock for JVM","archived":false,"fork":false,"pushed_at":"2024-04-29T11:22:52.000Z","size":2354,"stargazers_count":33,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-01T09:39:48.352Z","etag":null,"topics":["distributed-lock","java","jvm","microservices","mongodb"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coditory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["coditory"]}},"created_at":"2019-07-04T08:07:14.000Z","updated_at":"2024-05-02T12:55:31.735Z","dependencies_parsed_at":"2024-03-30T14:26:27.173Z","dependency_job_id":"b45855ff-8a1e-4378-b4cb-499f21e05409","html_url":"https://github.com/coditory/sherlock-distributed-lock","commit_stats":null,"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditory%2Fsherlock-distributed-lock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditory%2Fsherlock-distributed-lock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditory%2Fsherlock-distributed-lock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditory%2Fsherlock-distributed-lock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coditory","download_url":"https://codeload.github.com/coditory/sherlock-distributed-lock/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234243104,"owners_count":18801724,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distributed-lock","java","jvm","microservices","mongodb"],"created_at":"2025-01-16T17:39:51.497Z","updated_at":"2025-09-25T20:31:22.926Z","avatar_url":"https://github.com/coditory.png","language":"Java","readme":"# Sherlock Distributed Lock\n[![Build](https://github.com/coditory/sherlock-distributed-lock/actions/workflows/build.yml/badge.svg)](https://github.com/coditory/sherlock-distributed-lock/actions/workflows/build.yml)\n[![Coverage](https://codecov.io/gh/coditory/sherlock-distributed-lock/branch/main/graph/badge.svg)](https://codecov.io/gh/coditory/sherlock-distributed-lock)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.coditory.sherlock/sherlock-api/badge.svg)](https://search.maven.org/search?q=com.coditory.sherlock)\n\n\u003e Java Distributed lock library with database migration capabilities\n\nLook for details in the [documentation](https://coditory.github.io/sherlock-distributed-lock/).\n\n- **[supports multiple databases](https://coditory.github.io/sherlock-distributed-lock/connectors/)** - [SQL databases](https://coditory.github.io/sherlock-distributed-lock/connectors/sql/), [MongoDB](https://coditory.github.io/sherlock-distributed-lock/connectors/mongo/) and more\n- **[multiple types of locks](https://coditory.github.io/sherlock-distributed-lock/locks)** - multiple ways to acquire a lock: reentrant, single-entrant and more\n- **[basic DB migration](https://coditory.github.io/sherlock-distributed-lock/migrator)** - provides database migration process based on locks. No need for another library.\n- **[synchronous and reactive API](https://coditory.github.io/sherlock-distributed-lock/api)** - exposes synchronous and reactive API (supports synchronous calls, Reactor, RxJava, Kotlin coroutines)\n- **minimal set of dependencies** - the main dependency is a database driver\n\n## Sample usage\n\nAdd dependency to `build.gradle`:\n```groovy\ndependencies {\n  implementation \"com.coditory.sherlock:sherlock-mongo:$version\"\n}\n```\n\nCreate synchronous MongoDB backed lock:\n```java\n// Get mongo collection\n// You can also use other DB or reactive API\nMongoClient mongoClient = MongoClients.create(\"mongodb://localhost:27017/sherlock\");\nMongoCollection\u003cDocument\u003e collection = mongoClient\n    .getDatabase(\"sherlock\")\n    .getCollection(\"locks\");\n\n// Create sherlock\nSherlock sherlock = MongoSherlock.create(collection);\n\n// Create a lock\nDistributedLock lock = sherlock.createLock(\"sample-lock\");\n\n// Acquire a lock, run action and finally release the lock\nlock.runLocked(() -\u003e System.out.println(\"Lock granted!\"));\n```\n\n","funding_links":["https://github.com/sponsors/coditory"],"categories":["分布式开发"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoditory%2Fsherlock-distributed-lock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoditory%2Fsherlock-distributed-lock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoditory%2Fsherlock-distributed-lock/lists"}