GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - reactor/reactor-pool

BranchesTags
Open more actions menu

Latest commit

 

History

1,064 Commits
1,064 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
codequality
codequality
 
 
docs/src/docs/dist
docs/src/docs/dist
 
 
gradle
gradle
 
 
reactor-pool-micrometer
reactor-pool-micrometer
 
 
reactor-pool
reactor-pool
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

Reactor-Pool

Join the chat at https://gitter.im/reactor/reactor CircleCI Code Coverage

The reactor-pool project aims at providing a generic object pool to reactive application that:

  • exposes a reactive API (Publisher input types, Mono return types)
  • is non-blocking (never blocking a user that makes an attempt to acquire() a resource)
  • has lazy acquire behavior

For 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.

// given Pool<T> pool
Mono<PooledRef<T>> grabResource = pool.acquire();
//no resource is actually requested yet at this point

grabResouce.subscribe();
//now one resource is requested from the pool asynchronously

//Another example, this time synchronously acquiring, immediately followed up by a release:
PooledRef<T> ref = grabResource.block(); //second subscription requests a second resource
ref.release().block(); //release() is also asynchronous and lazy

For use-cases where the resource itself can be consumed reactively (exposes a reactive API), a scoped mode of acquisition is offered. withPoolable:

  • let the consumer declaratively use the resource
  • provides a scope / closure in which the resource is acquired, used as instructed and released automatically
  • avoids dealing with an indirection (the resource is directly exposed)
//given at DbConnection type and a Pool<DbConnection> pool
pool.withPoolable(resource -> resource
    //we declare using the connection to create a Statement...
    .createStatement()
    //...then performing a SELECT query...
    .flatMapMany(st -> st.query("SELECT * FROM foo"))
    //...then marshalling the rows to JSON
    .map(row -> rowToJson(row))
    //(all of which need the live resource)
)
//at this point the rest of the steps are outside the scope
//so the resource can be released
.map(json -> sanitize(json));

Licensed under Apache Software License 2.0

About

No description, website, or topics provided.

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

150 stars

Watchers

14 watching

Forks

41 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.