nf.fr.eraasoft.pool.impl
Class AbstractPool<T>

java.lang.Object
  extended by nf.fr.eraasoft.pool.impl.AbstractPool<T>
Type Parameters:
T -
All Implemented Interfaces:
Controlable, ObjectPool<T>
Direct Known Subclasses:
BlockingQueueObjectPool, ConcurrentLinkedQueuePool

public abstract class AbstractPool<T>
extends java.lang.Object
implements ObjectPool<T>, Controlable

Object pool implementation based on LinkedBlockingQueue
Use PoolSettings class to obtain an instance of this class

Author:
eddie
See Also:
PoolSettings

Constructor Summary
AbstractPool(PoolableObject<T> poolableObject, PoolSettings<T> settings)
           
 
Method Summary
 int actives()
           
 void clear()
          Clear the object pool
protected  void create()
           
 void destroy()
          Destroy the pool
 int idles()
           
protected  void init()
           
 void remove(int nbObjects)
          remove idle objects
 void returnObj(T t)
          Return object to the pool
 java.lang.String toString()
           
 void validateIdles()
          validate idle objects
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface nf.fr.eraasoft.pool.ObjectPool
getObj
 

Constructor Detail

AbstractPool

public AbstractPool(PoolableObject<T> poolableObject,
                    PoolSettings<T> settings)
Method Detail

init

protected void init()
             throws PoolException
Throws:
PoolException

create

protected void create()
               throws PoolException
Throws:
PoolException

returnObj

public void returnObj(T t)
Description copied from interface: ObjectPool
Return object to the pool

Specified by:
returnObj in interface ObjectPool<T>

idles

public int idles()
Specified by:
idles in interface Controlable
Returns:
number of idles objects

remove

public void remove(int nbObjects)
Description copied from interface: Controlable
remove idle objects

Specified by:
remove in interface Controlable
Parameters:
nbObjects - number of idle objects to remove

clear

public void clear()
Description copied from interface: Controlable
Clear the object pool

Specified by:
clear in interface Controlable

destroy

public void destroy()
Description copied from interface: Controlable
Destroy the pool

Specified by:
destroy in interface Controlable

actives

public int actives()
Specified by:
actives in interface Controlable
Returns:
number of active objects

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

validateIdles

public void validateIdles()
Description copied from interface: Controlable
validate idle objects

Specified by:
validateIdles in interface Controlable


Copyright © 2013. All Rights Reserved.