public static class

Pools.SynchronizedPool

extends Pools.SimplePool<T>
java.lang.Object
   ↳ com.davidluoye.support.utils.Pools.SimplePool<T>
     ↳ com.davidluoye.support.utils.Pools.SynchronizedPool<T>

Class Overview

Synchronized pool of objects.

Summary

Public Constructors
SynchronizedPool(int maxPoolSize, Object lock)
Creates a new instance.
SynchronizedPool(int maxPoolSize)
Public Methods
T acquire()
boolean release(T element)
Release an instance to the pool.
[Expand]
Inherited Methods
From class com.davidluoye.support.utils.Pools.SimplePool
From class java.lang.Object
From interface com.davidluoye.support.utils.Pools.Pool

Public Constructors

public SynchronizedPool (int maxPoolSize, Object lock)

Creates a new instance.

Parameters
maxPoolSize The max pool size.
lock an optional custom object to synchronize on
Throws
IllegalArgumentException If the max pool size is less than zero.

public SynchronizedPool (int maxPoolSize)

Public Methods

public T acquire ()

public boolean release (T element)

Release an instance to the pool.

Parameters
element The instance to release.
Returns
  • Whether the instance was put in the pool.