{"id":32187508,"url":"https://github.com/bnert-land/virtual","last_synced_at":"2026-02-21T00:02:03.388Z","repository":{"id":196886204,"uuid":"697264472","full_name":"bnert-land/virtual","owner":"bnert-land","description":"Java 21 Virtual Thread Utilities","archived":false,"fork":false,"pushed_at":"2024-10-23T18:35:16.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T00:05:53.835Z","etag":null,"topics":["clojure","java-21","virtual-threads"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bnert-land.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}},"created_at":"2023-09-27T11:30:12.000Z","updated_at":"2024-10-23T18:35:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"6b173d73-272b-4e5f-a152-23c4aebf118f","html_url":"https://github.com/bnert-land/virtual","commit_stats":null,"previous_names":["bnert-land/tacit","bnert-land/virtual"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bnert-land/virtual","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnert-land%2Fvirtual","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnert-land%2Fvirtual/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnert-land%2Fvirtual/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnert-land%2Fvirtual/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bnert-land","download_url":"https://codeload.github.com/bnert-land/virtual/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnert-land%2Fvirtual/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280354818,"owners_count":26316547,"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","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"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":["clojure","java-21","virtual-threads"],"created_at":"2025-10-22T00:04:31.475Z","updated_at":"2025-10-22T00:09:37.462Z","avatar_url":"https://github.com/bnert-land.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# virtual\n\n[![Clojars Project](https://img.shields.io/clojars/v/land.bnert/virtual.svg)](https://clojars.org/land.bnert/virtual)\n\nJava 21 Virtual Thread Utilities\n\n## Motivation\n\nProvide a more \"clojure-y\" syntax over Java 21's Virtual Thread Executor.\n\n\n## Usage\n\nWith \"future-like\" api:\n```clojure\n(ns example.core\n  (:require\n    [virtual.core :refer [virtual virtual-let]]))\n\n(defn -main [\u0026 _args]\n    ; Will execute operation on a virtual thread.\n    ; Result of the function is available via deref, given the underlying\n    ; threading model returns a Future\u003cT\u003e.\n    (-\u003e @(virtual (slurp (io/file \"some-file.edn\"))) ; should \"park\" on io\n        edn/read-string)\n\n    (-\u003e @(virtual-let [fname \"config.edn\"] (io/resource fname))\n        slurp\n        edn/read-string))\n```\n\nMonkey patching `clojure.core.async` to use virtual threads as the\nthread executor:\n```clojure\n(ns example.core\n  (:require\n    [clojure.core.async :refer [go chan \u003c!! \u003c! \u003e! take]]\n    [virtual.async :refef [use-virtual-thread-executor!]]))\n\n; Should be called, given this has a side effect of modifying the clojure.core.async\n; thread pool executor.\n(use-virtual-thread-executor!)\n\n(def messages (chan))\n(def processed (chan))\n\n(def message-processor\n  (go-loop []\n    (let [value      (\u003c! messages)\n          group-name (.getName (.getThreadGroup (Thread/currentThread)))]\n      (\u003e! processed (into value {:processor-thread-group grou-name})))\n    (recur)))\n\n(defn -main [\u0026 _args]\n  (dotimes [i 10]\n    (put! messages {:from i :to (dec i), :message \"hello!\"}))\n  (println (\u003c!! (take 10 processed))))\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnert-land%2Fvirtual","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbnert-land%2Fvirtual","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnert-land%2Fvirtual/lists"}