{"id":37024233,"url":"https://github.com/hcoona/native-named-mutex","last_synced_at":"2026-01-14T02:55:39.676Z","repository":{"id":57733406,"uuid":"84945037","full_name":"hcoona/native-named-mutex","owner":"hcoona","description":"Cross platform named mutex which provide a system-wide mutex synchronization primitive","archived":true,"fork":false,"pushed_at":"2019-08-29T09:52:12.000Z","size":57,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-24T00:17:42.137Z","etag":null,"topics":["java","java-library","mutex","synchronization"],"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/hcoona.png","metadata":{"files":{"readme":"README.adoc","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}},"created_at":"2017-03-14T12:12:17.000Z","updated_at":"2023-05-04T12:16:06.000Z","dependencies_parsed_at":"2022-09-13T08:40:47.167Z","dependency_job_id":null,"html_url":"https://github.com/hcoona/native-named-mutex","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/hcoona/native-named-mutex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hcoona%2Fnative-named-mutex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hcoona%2Fnative-named-mutex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hcoona%2Fnative-named-mutex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hcoona%2Fnative-named-mutex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hcoona","download_url":"https://codeload.github.com/hcoona/native-named-mutex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hcoona%2Fnative-named-mutex/sbom","scorecard":{"id":458711,"data":{"date":"2025-08-11","repo":{"name":"github.com/hcoona/native-named-mutex","commit":"b0d9dfcac37f00d054acde09971ceab40de143e9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-5mg8-w23w-74h3","Warn: Project is vulnerable to: GHSA-7g45-4rm6-3mm3","Warn: Project is vulnerable to: GHSA-mvr2-9pj6-7w5j"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T10:29:57.739Z","repository_id":57733406,"created_at":"2025-08-19T10:29:57.740Z","updated_at":"2025-08-19T10:29:57.740Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408798,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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":["java","java-library","mutex","synchronization"],"created_at":"2026-01-14T02:55:39.094Z","updated_at":"2026-01-14T02:55:39.658Z","avatar_url":"https://github.com/hcoona.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"image:https://travis-ci.org/hcoona/native-named-mutex.svg?branch=master[\"Build Status\", link=\"https://travis-ci.org/hcoona/native-named-mutex\"]\nimage:https://maven-badges.herokuapp.com/maven-central/io.github.hcoona/native-named-mutex/badge.svg[\"Maven Package Version\", link=\"https://repo1.maven.org/maven2/io/github/hcoona/native-named-mutex/\"]\n\n= native-named-mutex =\n\nThis is a Java library to provide a cross-platform system-wide named mutex synchronization primitive. It could be used for inter-process synchronization.\n\n**Moved to link:https://github.com/hcoona/one/tree/master/native-named-mutex[https://github.com/hcoona/one/tree/master/native-named-mutex]**\n\n[source,xml]\n-------------------------------------------\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.hcoona\u003c/groupId\u003e\n    \u003cartifactId\u003enative-named-mutex\u003c/artifactId\u003e\n    \u003cversion\u003e1.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n-------------------------------------------\n\n== Underlying ==\n\nIt underlying use system API to implement Mutex.\n\n[horizontal]\n*Windows*:: Use https://msdn.microsoft.com/en-us/library/windows/desktop/ms682411(v=vs.85).aspx[CreateMutex] API\n            to create or open a named mutex object.\n*Linux*:: Use named semaphore in pthread to simulate a mutex.\n*Other*:: Use Java `FileLock` and `ReentrantLock` to simulate a mutex.\n\n== Future plan ==\n\nNotice that *macOS is supported in Other platform* because macOS does not implement all posix semaphores API, especially `sem_timedwait`.\n\nIt is possible to leverage the Posix robust mutex with shared memory for more reliability in the future, so please *NOT assume it always use semaphore on Linux*. (See discussion https://github.com/dotnet/coreclr/issues/3422[here] for more details)\n\n== Usage ==\n\n=== Singleton your service in system-wide ===\n\nYou somehow might have to ensure there is only 1 instance running in your system.\nThis is specially useful in enterprise services.\n\n[source,java]\n-------------------------------------------\npublic static void main(String[] args) {\n    final String mutexName = \"/UniqueNameForYourService\";\n    try (NamedMutex mutex = NamedMutex.newInstance(true, mutexName)) {\n        mutex.waitOne();\n        Service service = createYourService();\n        service.run();\n    }\n}\n-------------------------------------------\n\nWait with a timeout limit is also supported.\n\n[source,java]\n-------------------------------------------\npublic static void main(String[] args) {\n    final String mutexName = \"/UniqueNameForYourService\";\n    try (NamedMutex mutex = NamedMutex.newInstance(true, mutexName)) {\n        if (mutex.waitOne(5, TimeUnit.SECONDS)) {\n            Service service = createYourService();\n            service.run();\n        } else {\n            System.err.println(\"Cannot startup because there is another instance already running.\");\n        }\n    }\n}\n-------------------------------------------\n\n=== Protect system-wide resources ===\n\nYou might need to run 2 apps but they have to use same TCP port some time.\n\n[source,java]\n-------------------------------------------\ntry (NamedMutex mutex = NamedMutex.newInstance(true, \"/Port_3386\")) {\n    mutex.waitOne();\n    HttpListener listener = new HttpListener(\"0.0.0.0\", 3386);\n}\n-------------------------------------------\n\n=== Synchronization between processes ===\n\nYou might need to synchronize between processes.\n\n[source,java]\n-------------------------------------------\ntry (NamedMutex mutex = NamedMutex.newInstance(false, \"/ProtectedSharedFileName\")) {\n    mutex.waitOne();\n    writeSharedFile();\n}\n-------------------------------------------\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhcoona%2Fnative-named-mutex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhcoona%2Fnative-named-mutex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhcoona%2Fnative-named-mutex/lists"}