org.ow2.util.pool.impl.enhanced.impl.keepbusy
Class KeepBusyPool<E>

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

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

Author:
Gael Lalire

Constructor Summary
KeepBusyPool(IPool<E> pool)
           
KeepBusyPool(IPool<E> pool, ReferenceType referenceType)
           
 
Method Summary
protected  void expunge()
           
 E get(IWaitControl timeout)
          This method block is there is no available pool item in the pool.
protected  java.util.Map<IIdentityReference<E>,PoolItemInfo> getBusyPoolItemList()
           
protected  WaitAuthorization getCurrentWaitAuthorization()
           
protected  java.util.concurrent.locks.Lock getLock()
           
protected  java.lang.ref.ReferenceQueue<E> getReferenceQueue()
           
protected  ReferenceType getReferenceType()
           
 ShareMethod getShareMethod()
           
protected  ShareMethod getShareMethod0()
           
 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 removeAll()
           
protected  void setCurrentWaitAuthorization(WaitAuthorization currentWaitAuthorization)
           
 void setShareMethod(ShareMethod shareMethod)
           
 void signalAllWaiters()
          Ask pool to recall all timeout.waitOnXXX.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeepBusyPool

public KeepBusyPool(IPool<E> pool)

KeepBusyPool

public KeepBusyPool(IPool<E> pool,
                    ReferenceType referenceType)
Method Detail

expunge

protected void expunge()

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

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 -
Throws:
PoolException
NotABusyPoolItemException - if error occurs

getShareMethod0

protected ShareMethod getShareMethod0()

getShareMethod

public ShareMethod getShareMethod()
Returns:
the shareMethod

setShareMethod

public void setShareMethod(ShareMethod shareMethod)
Parameters:
shareMethod - the shareMethod to set

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>

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

getBusyPoolItemList

protected java.util.Map<IIdentityReference<E>,PoolItemInfo> getBusyPoolItemList()
Returns:
the busyPoolItemList

getLock

protected final java.util.concurrent.locks.Lock getLock()
Returns:
the lock

removeAll

public void removeAll()

getReferenceQueue

protected java.lang.ref.ReferenceQueue<E> getReferenceQueue()

getReferenceType

protected ReferenceType getReferenceType()

getCurrentWaitAuthorization

protected WaitAuthorization getCurrentWaitAuthorization()

setCurrentWaitAuthorization

protected void setCurrentWaitAuthorization(WaitAuthorization currentWaitAuthorization)


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