Fast, lightweight, and compatible blocking/non-blocking/soft-reference object pool for Java 6+
Go to file
nathan 88147a0811 Added support for intellij 2015-06-26 22:37:36 +02:00
src/dorkbox/util/objectPool Refactored package, placed into .util 2015-02-02 12:40:12 +01:00
.classpath Initial import of ObjectPool project 2015-02-02 00:33:46 +01:00
.gitignore Initial import of ObjectPool project 2015-02-02 00:33:46 +01:00
.project Initial import of ObjectPool project 2015-02-02 00:33:46 +01:00
LICENSE Updated license info. Updated Readme. 2015-02-02 00:40:05 +01:00
LICENSE.Apachev2 Initial import of ObjectPool project 2015-02-02 00:33:46 +01:00
ObjectPool.iml Added support for intellij 2015-06-26 22:37:36 +02:00
README.md Added extra info to the readme 2015-02-08 02:36:04 +01:00

README.md

ObjectPool

This provides an ObjectPool factory, for providing two different types of object pools. Safe and unsafe.

The main distinction between this pool and others, is speed and compatibility. The factory offers two implementations:

The faster implementation uses UNSAFE, which is unavailable on android and non-oracle JVMs, in which case the fallback pool is used, which is based on a LinkedBlockingDeque.

If the list gets hot and contended, you can get scaling bugs. It gets complicated too fast and is not worth it for small to even moderate sized objects.

Use it only for large objects.

  • This is for cross-platform use, specifically - linux 32/64, mac 32/64, and windows 32/64. Java 6+

Usage:

   /**
    * Takes an object from the pool
    */
    public ObjectPoolHolder<T> take();

   /**
    * Return object to the pool
    */
    public void release(ObjectPoolHolder<T> object);