ObjectPool/README.md

69 lines
2.0 KiB
Markdown
Raw Normal View History

2015-02-02 00:36:28 +01:00
ObjectPool
==========
2016-02-09 18:16:54 +01:00
This provides an ObjectPool, for providing for a safe, and fixed sized pool of objects. This is only recommended in systems were garbage collection is to be kept to a minimum, and the created objects are large.
2015-02-02 00:36:28 +01:00
- This is for cross-platform use, specifically - linux 32/64, mac 32/64, and windows 32/64. Java 6+
Usage:
```
/**
2016-02-09 18:03:18 +01:00
* Takes an object from the pool, Blocks until an item is available in the pool.
2015-02-02 00:36:28 +01:00
*/
public ObjectPoolHolder<T> take();
2016-02-09 18:03:18 +01:00
/**
* Takes an object from the pool, Blocks until an item is available in the pool.
* <p/>
* This method catches {@link InterruptedException} and discards it silently.
*/
T takeUninterruptibly() {
/**
* Return object to the pool, waking the threads that have blocked during take()
*/
void release(T object);
/**
* @return a new object instance created by the pool.
*/
T newInstance();
/**
* @return the number of currently pooled objects
*/
int size();
2015-02-02 00:36:28 +01:00
```
2016-02-09 18:16:54 +01:00
2017-02-18 23:59:18 +01:00
&nbsp;
&nbsp;
Release Notes
---------
This project includes some utility classes that are a small subset of a much larger library. These classes are **kept in sync** with the main utilities library, so "jar hell" is not an issue, and the latest release will always include the same version of utility files as all of the other projects in the dorkbox repository at that time.
Please note that the utility source code is included in the release and on our [GitHub](https://github.com/dorkbox/Utilities) repository.
Maven Info
---------
2016-02-09 18:16:54 +01:00
```
<dependency>
<groupId>com.dorkbox</groupId>
<artifactId>ObjectPool</artifactId>
2017-02-21 14:43:47 +01:00
<version>2.8</version>
2016-02-09 18:16:54 +01:00
</dependency>
```
Or if you don't want to use Maven, you can access the files directly here:
https://oss.sonatype.org/content/repositories/releases/com/dorkbox/ObjectPool/
2017-02-18 23:59:18 +01:00
License
---------
2016-04-05 14:47:40 +02:00
This project is © 2014 dorkbox llc, and is distributed under the terms of the Apache v2.0 License. See file "LICENSE" for further references.