org.ow2.util.pool.impl.enhanced.impl.validator
Class ValidatorPool<E>

java.lang.Object
  extended by org.ow2.util.pool.impl.enhanced.impl.validator.ValidatorPool<E>
Type Parameters:
E - pool item type
All Implemented Interfaces:
IPool<E>
Direct Known Subclasses:
ValidatorCluePool

public class ValidatorPool<E>
extends java.lang.Object
implements IPool<E>

Author:
Gael Lalire

Constructor Summary
ValidatorPool(IPool<E> pool, IPoolValidator<E> poolValidator, boolean putValidate)
           
 
Method Summary
 E get(IWaitControl timeout)
          This method block is there is no available pool item in the pool.
 void put(E poolItem)
          This method must be called when you finished to use the pool item.
 void remove(E poolItem)
          This method can be called when you finished to use the pool item instead of put method.
 void signalAllWaiters()
          Ask pool to recall all timeout.waitOnXXX.
protected  boolean validateOneItem(E poolItem)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidatorPool

public ValidatorPool(IPool<E> pool,
                     IPoolValidator<E> poolValidator,
                     boolean putValidate)
Method Detail

validateOneItem

protected boolean validateOneItem(E poolItem)

get

public E get(IWaitControl timeout)
      throws PoolException,
             java.lang.InterruptedException
Description copied from interface: IPool
This method block is there is no available pool item in the pool.

Specified by:
get in interface IPool<E>
Parameters:
timeout - if the get wait more than timeout then the method throw a TimeoutPoolException.
Returns:
a pool item
Throws:
PoolException - if error occurs
java.lang.InterruptedException

signalAllWaiters

public void signalAllWaiters()
Description copied from interface: IPool
Ask pool to recall all timeout.waitOnXXX. So if you change a WaitAuthorization state you can avoid all waiters.

Specified by:
signalAllWaiters in interface IPool<E>

put

public void put(E poolItem)
         throws NotABusyPoolItemException
Description copied from interface: IPool
This method must be called when you finished to use the pool item.

Specified by:
put in interface IPool<E>
Parameters:
poolItem - a pool item
Throws:
NotABusyPoolItemException - if error occurs

remove

public void remove(E poolItem)
            throws NotABusyPoolItemException
Description copied from interface: IPool
This method can be called when you finished to use the pool item instead of put method. If you call this method the pool item will be replace with a new.

Specified by:
remove in interface IPool<E>
Parameters:
poolItem - a pool item
Throws:
NotABusyPoolItemException - if error occurs


Copyright © 2007-2009 OW2 Consortium. All Rights Reserved.