{"id":16367161,"url":"https://github.com/snower/jaslock","last_synced_at":"2026-05-14T08:02:12.479Z","repository":{"id":48162597,"uuid":"434188259","full_name":"snower/jaslock","owner":"snower","description":"slock java client","archived":false,"fork":false,"pushed_at":"2025-09-08T08:44:45.000Z","size":228,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-08T10:33:32.563Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snower.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-12-02T11:10:06.000Z","updated_at":"2025-08-21T10:36:49.000Z","dependencies_parsed_at":"2025-12-30T21:05:56.603Z","dependency_job_id":null,"html_url":"https://github.com/snower/jaslock","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/snower/jaslock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snower%2Fjaslock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snower%2Fjaslock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snower%2Fjaslock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snower%2Fjaslock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snower","download_url":"https://codeload.github.com/snower/jaslock/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snower%2Fjaslock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33015817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-11T02:48:46.087Z","updated_at":"2026-05-14T08:02:12.474Z","avatar_url":"https://github.com/snower.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jaslock\n\n[![Tests](https://img.shields.io/github/actions/workflow/status/snower/jaslock/build-test.yml?label=tests)](https://github.com/snower/jaslock/actions/workflows/build-test.yml)\n[![GitHub Repo stars](https://img.shields.io/github/stars/snower/jaslock?style=social)](https://github.com/snower/jaslock/stargazers)\n\nHigh-performance distributed sync service and atomic DB. Provides good multi-core support through lock queues, high-performance asynchronous binary network protocols. Can be used for spikes, synchronization, event notification, concurrency control. https://github.com/snower/slock\n\n# Install\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.snower\u003c/groupId\u003e\n    \u003cartifactId\u003ejaslock\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.3\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n# Client Lock\n\n```java\npackage main;\n\nimport io.github.snower.jaslock.SlockClient;\nimport io.github.snower.jaslock.Event;\nimport io.github.snower.jaslock.Lock;\nimport io.github.snower.jaslock.SlockReplsetClient;\nimport io.github.snower.jaslock.SlockClient;\nimport io.github.snower.jaslock.exceptions.SlockException;\n\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\n\npublic class App {\n    public static void main(String[] args) {\n        SlockClient client = new SlockClient(\"127.0.0.1\", 5658);\n        try {\n            client.open();\n            Lock lock = client.newLock(\"test\", 5, 5);\n            lock.acquire();\n            lock.release();\n        } catch (IOException | SlockException e) {\n            e.printStackTrace();\n        } finally {\n            client.close();\n        }\n    }\n}\n```\n\n# Replset Client Lock\n\n```java\npackage main;\n\nimport io.github.snower.jaslock.SlockClient;\nimport io.github.snower.jaslock.Event;\nimport io.github.snower.jaslock.Lock;\nimport io.github.snower.jaslock.SlockReplsetClient;\nimport io.github.snower.jaslock.exceptions.SlockException;\n\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\n\npublic class App {\n    public static void main(String[] args) {\n        SlockReplsetClient replsetClient = new SlockReplsetClient(new String[]{\"127.0.0.1:5658\"});\n        try {\n            replsetClient.open();\n            Lock lock = replsetClient.newLock(\"test\", 5, 5);\n            lock.acquire();\n            lock.release();\n        } catch (SlockException e) {\n            e.printStackTrace();\n        } finally {\n            replsetClient.close();\n        }\n    }\n}\n```\n\n# Async Callback Lock\n\n```java\npackage main;\n\nimport io.github.snower.jaslock.SlockClient;\nimport io.github.snower.jaslock.Event;\nimport io.github.snower.jaslock.Lock;\nimport io.github.snower.jaslock.SlockReplsetClient;\nimport io.github.snower.jaslock.SlockClient;\nimport io.github.snower.jaslock.exceptions.SlockException;\n\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\n\npublic class App {\n    public static void main(String[] args) {\n        SlockClient client = new SlockClient(\"127.0.0.1\", 5658);\n        client.enableAsyncCallback();\n        try {\n            client.open();\n            Lock lock = client.newLock(\"test\", 5, 5);\n            lock.acquire(callbackFuture -\u003e {\n                try {\n                    callbackFuture.getResult();\n                    lock.release(callbackFuture1 -\u003e {\n                        try {\n                            callbackFuture1.getResult();\n                            System.out.println(\"succed\");\n                        } catch (IOException | SlockException e) {\n                            e.printStackTrace();\n                        } finally {\n                            client.close();\n                        }\n                    });\n                } catch (IOException | SlockException e) {\n                    e.printStackTrace();\n                    client.close();\n                }\n            });\n        } catch (IOException | SlockException e) {\n            e.printStackTrace();\n            client.close();\n        }\n\n        try {\n            Thread.sleep(2000);\n        } catch (InterruptedException ignored1) {}\n    }\n}\n```\n\n# Async Future Lock\n\n```java\npackage main;\n\nimport io.github.snower.jaslock.SlockClient;\nimport io.github.snower.jaslock.Event;\nimport io.github.snower.jaslock.Lock;\nimport io.github.snower.jaslock.SlockReplsetClient;\nimport io.github.snower.jaslock.SlockClient;\nimport io.github.snower.jaslock.exceptions.SlockException;\n\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\nimport java.util.concurrent.ExecutionException;\n\npublic class App {\n    public static void main(String[] args) {\n        SlockReplsetClient replsetClient = new SlockReplsetClient(new String[]{\"127.0.0.1:5658\"});\n        replsetClient.enableAsyncCallback();\n        try {\n            replsetClient.open();\n            Lock lock = replsetClient.newLock(\"test\", 5, 5);\n            CallbackFuture\u003cBoolean\u003e callbackFuture = lock.acquire(null);\n            callbackFuture.get();\n            callbackFuture = lock.release(null);\n            callbackFuture.get();\n        } catch (IOException | SlockException | ExecutionException | InterruptedException e) {\n            e.printStackTrace();\n        } finally {\n            client.close();\n        }\n    }\n}\n```\n\n# Event\n\n```java\npackage main;\n\nimport io.github.snower.jaslock.SlockClient;\nimport io.github.snower.jaslock.Event;\nimport io.github.snower.jaslock.Lock;\nimport io.github.snower.jaslock.SlockReplsetClient;\nimport io.github.snower.jaslock.SlockReplsetClient;\nimport io.github.snower.jaslock.exceptions.SlockException;\n\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\n\npublic class App {\n    public static void main(String[] args) {\n        SlockReplsetClient replsetClient = new SlockReplsetClient(new String[]{\"127.0.0.1:5658\"});\n        try {\n            replsetClient.open();\n            Event event1 = replsetClient.newEvent(\"test\", 5, 5, true);\n            event1.clear();\n\n            Event event2 = replsetClient.newEvent(\"test\", 5, 5, true);\n            event2.set(\"{\\\"value\\\": 10}\");\n\n            event1.wait(10);\n            System.out.println(event1.getCurrentLockDataAsString());\n        } catch (SlockException e) {\n            e.printStackTrace();\n        } finally {\n            replsetClient.close();\n        }\n    }\n}\n```\n\n# License\n\nslock uses the MIT license, see LICENSE file for the details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnower%2Fjaslock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnower%2Fjaslock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnower%2Fjaslock/lists"}