-
public final class FactoryPoolsProvides implementations of Pool never return
{@code null}, log when new instances are created, and that can use the com.mobwith.imgmodule.util.pool.FactoryPools.Poolable interface to ensure objects aren't used while inside the pool.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceFactoryPools.FactoryCreates new instances of the given type.
public interfaceFactoryPools.ResetterResets state when objects are returned to the pool.
public interfaceFactoryPools.PoolableAllows additional verification to catch errors caused by using objects while they are in anobject pool.
-
Method Summary
Modifier and Type Method Description static <T extends FactoryPools.Poolable> Pools.Pool<T>simple(int size, @NonNull() FactoryPools.Factory<T> factory)Returns a non-thread safe Pool that never returns {@code null}from and that contains objects of the type created by the given Factory withthe given maximum size.static <T extends FactoryPools.Poolable> Pools.Pool<T>threadSafe(int size, @NonNull() FactoryPools.Factory<T> factory)Returns a new thread safe Pool that never returns {@code null}from and that contains objects of the type created by the given Factory withthe given maximum size.static <T> Pools.Pool<List<T>>threadSafeList()Returns a new Pool that never returns {@code null}and that contains Lists of a specific generic type with a standard maximum size of 20.static <T> Pools.Pool<List<T>>threadSafeList(int size)Returns a new thread safe Pool that never returns {@code null}and that contains Lists of a specific generic type with the given maximum size.-
-
Method Detail
-
simple
@NonNull() static <T extends FactoryPools.Poolable> Pools.Pool<T> simple(int size, @NonNull() FactoryPools.Factory<T> factory)
-
threadSafe
@NonNull() static <T extends FactoryPools.Poolable> Pools.Pool<T> threadSafe(int size, @NonNull() FactoryPools.Factory<T> factory)
-
threadSafeList
@NonNull() static <T> Pools.Pool<List<T>> threadSafeList()
-
threadSafeList
@NonNull() static <T> Pools.Pool<List<T>> threadSafeList(int size)
-
-
-
-