Fast, lightweight, and compatible blocking/non-blocking/soft-reference object pool for Java 6+
Go to file
nathan a7a57c71bb updated project info 2015-08-23 02:41:23 +02:00
src/dorkbox/util/objectPool Updated objectPool to support "reset" for objects returned to the pool. 2015-08-22 23:43:53 +02:00
test/dorkbox/util/objectPool Added intellij support. Compiled as java6. Pool.take() will wait if there are no more objects in the pool. 2015-06-28 00:45:33 +02:00
.classpath Added intellij support. Compiled as java6. Pool.take() will wait if there are no more objects in the pool. 2015-06-28 00:45:33 +02: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 Update license 2015-06-28 20:21:39 +02:00
LICENSE.Apachev2 Initial import of ObjectPool project 2015-02-02 00:33:46 +01:00
ObjectPool.iml updated project info 2015-08-23 02:41:23 +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);