org.ow2.util.pool.impl.enhanced.impl.limited
Class LimitedWaiterPool<E>
java.lang.Object
org.ow2.util.pool.impl.enhanced.impl.limited.LimitedWaiterPool<E>
- Type Parameters:
E - pool item type
- All Implemented Interfaces:
- IPool<E>
- Direct Known Subclasses:
- LimitedWaiterCluePool
public class LimitedWaiterPool<E>
- extends java.lang.Object
- implements IPool<E>
- Author:
- Gael Lalire
|
Method Summary |
protected void |
addWaiter()
|
E |
get(IWaitControl timeout)
This method block is there is no available pool item
in the pool. |
void |
put(E e)
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. |
protected void |
removeWaiter()
|
void |
setMaxWaiter(int maxWaiter)
|
void |
signalAllWaiters()
Ask pool to recall all timeout.waitOnXXX. |
void |
waitEmptyWaiterInPool()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NO_LIMIT_WAITER
public static final int NO_LIMIT_WAITER
- See Also:
- Constant Field Values
LimitedWaiterPool
public LimitedWaiterPool(IPool<E> pool)
LimitedWaiterPool
public LimitedWaiterPool(IPool<E> pool,
int maxWaiter)
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
addWaiter
protected void addWaiter()
throws TooManyWaiterException
- Throws:
TooManyWaiterException
removeWaiter
protected void removeWaiter()
throws TooManyWaiterException
- Throws:
TooManyWaiterException
put
public void put(E e)
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:
e - a pool item
- Throws:
NotABusyPoolItemException - if error occurs
setMaxWaiter
public void setMaxWaiter(int maxWaiter)
- Parameters:
maxWaiter - the maxWaiter 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
waitEmptyWaiterInPool
public void waitEmptyWaiterInPool()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
Copyright © 2007-2009 OW2 Consortium. All Rights Reserved.