Stormpot is an object pooling library for Java. Use it to recycle objects that are expensive to create. The library will take care of creating and destroying your objects in the background.
image:https://api.travis-ci.org/chrisvest/stormpot.svg?branch=master[Build status, link=https://travis-ci.org/chrisvest/stormpot] image:https://img.shields.io/lgtm/grade/java/g/chrisvest/stormpot.svg?logo=lgtm&logoWidth=18[Code quality, link=https://lgtm.com/projects/g/chrisvest/stormpot/context:java] image:https://codecov.io/gh/chrisvest/stormpot/branch/master/graph/badge.svg[Code coverage, link=https://codecov.io/gh/chrisvest/stormpot]
Stormpot is very mature, is used in production, and has done hundreds of trillions footnote:[Fermi estimate.] claim-release cycles in testing. It is faster and scales better than any competing pool.
=== Why choose Stormpot?
There are a number of options out there, when it comes to object pools on the JVM. Stormpot has been carefully designed for high performance, and robust operation. Some of the things that sets Stormpot apart include:
Pool.of(...). (since 3.0)
PoolTaps. (since 3.0)
Pool.fromInline(). (since 3.1)
claimsince the objects are all similar. If your objects instead are heterogeneous, with different attributes and identified by a key, then what you need is a object cache. We recommend https://github.com/ben-manes/caffeine[Caffeine] for object caching.
Stormpot 3.1 only depends on Java 11 or newer. Add it as a Maven dependency to your projects:
You can also build the latest snapshot from source with
mvn clean install.
=== Getting Started
Stormpot needs 3 things before it can pool objects for you:
. A http://chrisvest.github.io/stormpot/site/apidocs/stormpot/stormpot/Poolable.html[Poolable] type of objects it can pool. You have to implement this yourself. . An http://chrisvest.github.io/stormpot/site/apidocs/stormpot/stormpot/Allocator.html[Allocator] to allocate and deallocate the Poolable objects. You have to implement this yourself. . And a place where it all comes together:
MyAllocator allocator = new MyAllocator(); Pool pool = Pool.from(allocator).build(); Timeout timeout = new Timeout(1, TimeUnit.SECONDS);
mvn clean pre-site javadoc:javadoc.
mvn checkstyle:checkto check your formatting. If you are writing a test that takes more than a few hundred milliseconds to run, then put it in the
stormpot.slowtest package; either in the existing
PoolITsuite, or in a new
mvn clean testto run only the fast tests. Use
mvn clean verifyto also run the slow tests. Javadoc comments are formatted with http://asciidoctor.org/[AsciiDoctor]. Get test coverage with
mvn clean test siteand
open target/site/jacoco/index.html. Get mutation test coverage with
mvn clean test-compile org.pitest:pitest-maven:mutationCoverageand
mvn versions:display-plugin-updates, or other dependencies with
Whatever you decide to do, don't hesitate to ask questions on the mailing list or on github if you have doubts or get stuck.