{"id":20768149,"url":"https://github.com/softwaremill/jox","last_synced_at":"2025-08-20T16:32:25.480Z","repository":{"id":207958664,"uuid":"716102180","full_name":"softwaremill/jox","owner":"softwaremill","description":"Fast and Scalable Channels in Java","archived":false,"fork":false,"pushed_at":"2024-05-22T11:06:30.000Z","size":357,"stargazers_count":160,"open_issues_count":7,"forks_count":5,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-05-22T11:56:02.300Z","etag":null,"topics":["channels","concurrency","java","loom"],"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/softwaremill.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}},"created_at":"2023-11-08T12:58:16.000Z","updated_at":"2024-06-04T16:31:32.834Z","dependencies_parsed_at":"2023-11-20T12:25:49.074Z","dependency_job_id":"3296c2b1-e4bd-47ff-8917-2b8c8bb861f9","html_url":"https://github.com/softwaremill/jox","commit_stats":null,"previous_names":["softwaremill/jox"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fjox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fjox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fjox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softwaremill%2Fjox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softwaremill","download_url":"https://codeload.github.com/softwaremill/jox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230438185,"owners_count":18225870,"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":["channels","concurrency","java","loom"],"created_at":"2024-11-17T11:35:55.999Z","updated_at":"2025-08-20T16:32:25.473Z","avatar_url":"https://github.com/softwaremill.png","language":"Java","readme":"# Jox\n\n[![Ideas, suggestions, problems, questions](https://img.shields.io/badge/Discourse-ask%20question-blue)](https://softwaremill.community/c/open-source/11)\n[![CI](https://github.com/softwaremill/jox/workflows/CI/badge.svg)](https://github.com/softwaremill/jox/actions?query=workflow%3A%22CI%22)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.softwaremill.jox/channels/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.softwaremill.jox/channels)\n[![javadoc](https://javadoc.io/badge2/com.softwaremill.jox/channels/javadoc.svg)](https://javadoc.io/doc/com.softwaremill.jox/channels)\n\n[Virtual-thread](https://docs.oracle.com/en/java/javase/21/core/virtual-threads.html) based safe concurrency \u0026 streaming\nfor Java 21+.\n\nIncludes:\n\n* Fast \u0026 scalable, completable channels, with Go-like `select`s\n* Programmer-friendly structured concurrency\n* Finite \u0026 infinite streaming using flows, with reactive streams compatibility, (blocking) I/O integration and a\n  high-level, “functional” API\n\nFind out more in the documentation available at [jox.softwaremill.com](https://jox.softwaremill.com/).\n\n## A tour of Jox\n\nSelectable [channels](https://jox.softwaremill.com/latest/channels.html):\n\n```\nvar ch1 = Channel.\u003cInteger\u003enewBufferedDefaultChannel();\nvar ch2 = Channel.\u003cInteger\u003enewBufferedDefaultChannel();\nvar ch3 = Channel.\u003cInteger\u003enewBufferedDefaultChannel();\n\n// send a value to two channels\nch2.send(29);\nch3.send(32);\n\nvar received = select(ch1.receiveClause(), ch2.receiveClause(), ch3.receiveClause());\n```\n\nA push-based, backpressured [flow](https://jox.softwaremill.com/latest/flows.html) with time-based \u0026 parallel processing:\n\n```\nvar nats =\n  Flows.unfold(0, i -\u003e Optional.of(Map.entry(i+1, i+1)));\n \nFlows.range(1, 100, 1)\n  .throttle(1, Duration.ofSeconds(1))\n  .mapPar(4, i -\u003e {\n    Thread.sleep(5000);\n    var j = i*3;\n    return j+1;\n  })\n  .filter(i -\u003e i % 2 == 0)\n  .zip(nats)\n  .runForeach(System.out::println);\n```\n\n[Sructured concurrency](https://jox.softwaremill.com/latest/structured.html) scope:\n\n```\nvar result = supervised(scope -\u003e {\n    var f1 = scope.fork(() -\u003e {\n        Thread.sleep(500);\n        return 5;\n    });\n    var f2 = scope.fork(() -\u003e {\n        Thread.sleep(1000);\n        return 6;\n    });\n    return f1.join() + f2.join();\n});\nSystem.out.println(\"result = \" + result);\n```\n\n## Feedback\n\nIs what we are looking for!\n\nLet us know in the issues, or our [community forum](https://softwaremill.community/c/open-source/11).\n\n## Project sponsor\n\nWe offer commercial development services. [Contact us](https://softwaremill.com) to learn more!\n\n## Building \u0026 working on Jox\n\nJox uses the spotless maven plugin to format code. The formatting is automatically applied during compilation.\nFormatting can be checked using `mvn spotless:check` and applied with `mvn spotless:apply`.\n\nWhen using VS Code, format-on-save should be disabled (see the pom.xml).\nFor IntelliJ, it might be necessary to install the spotless plugin to properly reformat the sources.\n\n## Copyright\n\nCopyright (C) 2023-2025 SoftwareMill [https://softwaremill.com](https://softwaremill.com).\n","funding_links":[],"categories":["并发编程"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwaremill%2Fjox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftwaremill%2Fjox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftwaremill%2Fjox/lists"}