public class BuilderPool<T extends Builder<U>,U> extends Object
Builders are frequently used throughout Catalyst. In order to reduce garbage collection for objects that are frequently
constructed by builders, the builder pool recycles builders themselves. When a builder is acquired
from a builder pool, an internal pool of existing builders will be polled for existing
builders. If no builders are left in the pool, a new builder will be allocated. When Builder.close()
is called the builder will be released ba
| Constructor and Description |
|---|
BuilderPool(Function<BuilderPool<T,U>,T> factory) |
| Modifier and Type | Method and Description |
|---|---|
T |
acquire()
Acquires a builder from the pool.
|
T |
acquire(U object)
Acquires a builder from the pool.
|
void |
release(T builder)
Releases the given builder back to the pool.
|
public BuilderPool(Function<BuilderPool<T,U>,T> factory)
NullPointerException - if factory is nullpublic T acquire()
If no builders remain in the pool, a new builder will be allocated via the factory
provided to this pool's constructor.
public T acquire(U object)
If no builders remain in the pool, a new builder will be allocated via the factory
provided to this pool's constructor.
object - The object to build.Copyright © 2013–2015. All rights reserved.