{"id":19966265,"url":"https://github.com/reactor/reactor-pool","last_synced_at":"2025-05-15T17:06:25.091Z","repository":{"id":37444214,"uuid":"153684176","full_name":"reactor/reactor-pool","owner":"reactor","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-28T11:22:16.000Z","size":1338,"stargazers_count":143,"open_issues_count":8,"forks_count":35,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-04-28T12:31:33.051Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reactor.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}},"created_at":"2018-10-18T20:34:53.000Z","updated_at":"2025-04-28T11:22:20.000Z","dependencies_parsed_at":"2023-11-21T18:27:45.369Z","dependency_job_id":"169b0e21-9a33-4d95-8ee4-9b0af61ca8f9","html_url":"https://github.com/reactor/reactor-pool","commit_stats":null,"previous_names":[],"tags_count":65,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactor%2Freactor-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactor%2Freactor-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactor%2Freactor-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactor%2Freactor-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reactor","download_url":"https://codeload.github.com/reactor/reactor-pool/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384988,"owners_count":22062422,"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":[],"created_at":"2024-11-13T02:34:16.187Z","updated_at":"2025-05-15T17:06:20.083Z","avatar_url":"https://github.com/reactor.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reactor-Pool\n\n[![Join the chat at https://gitter.im/reactor/reactor](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/reactor/reactor?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![CircleCI](https://circleci.com/gh/reactor/reactor-pool.svg?style=svg)](https://circleci.com/gh/reactor/reactor-pool)\n[![Code Coverage](https://codecov.io/gh/reactor/reactor-pool/graph/badge.svg)](https://codecov.io/gh/reactor/reactor-pool)\n\nThe `reactor-pool` project aims at providing a generic object pool to reactive application that:\n - exposes a reactive API (`Publisher` input types, `Mono` return types)\n - is non-blocking (never blocking a user that makes an attempt to `acquire()` a resource)\n - has lazy acquire behavior\n\nFor use-cases where granular control of the `release()` is needed, the classic path of `acquire()` is offered, which exposes a `PooledRef` wrapper to the resource. This also allows access to statistics about the resource lifecycle in the pool.\n\n```java\n// given Pool\u003cT\u003e pool\nMono\u003cPooledRef\u003cT\u003e\u003e grabResource = pool.acquire();\n//no resource is actually requested yet at this point\n\ngrabResouce.subscribe();\n//now one resource is requested from the pool asynchronously\n\n//Another example, this time synchronously acquiring, immediately followed up by a release:\nPooledRef\u003cT\u003e ref = grabResource.block(); //second subscription requests a second resource\nref.release().block(); //release() is also asynchronous and lazy\n```\n\nFor use-cases where the resource itself can be consumed reactively (exposes a reactive API), a scoped mode of acquisition is offered. `withPoolable`:\n - let the consumer declaratively use the resource\n - provides a scope / closure in which the resource is acquired, used as instructed and released automatically\n - avoids dealing with an indirection (the resource is directly exposed)\n\n```java\n//given at DbConnection type and a Pool\u003cDbConnection\u003e pool\npool.withPoolable(resource -\u003e resource\n    //we declare using the connection to create a Statement...\n    .createStatement()\n    //...then performing a SELECT query...\n    .flatMapMany(st -\u003e st.query(\"SELECT * FROM foo\"))\n    //...then marshalling the rows to JSON\n    .map(row -\u003e rowToJson(row))\n    //(all of which need the live resource)\n)\n//at this point the rest of the steps are outside the scope\n//so the resource can be released\n.map(json -\u003e sanitize(json));\n```\n\n_Licensed under [Apache Software License 2.0](www.apache.org/licenses/LICENSE-2.0)_","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactor%2Freactor-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freactor%2Freactor-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactor%2Freactor-pool/lists"}