org.apache.avalon.excalibur.pool
Class VariableSizePool
java.lang.Object
|
+--org.apache.avalon.excalibur.pool.VariableSizePool
- All Implemented Interfaces:
- org.apache.avalon.framework.component.Component, org.apache.avalon.framework.activity.Disposable, ManagablePool, Pool
- public final class VariableSizePool
- extends java.lang.Object
- implements Pool, org.apache.avalon.framework.activity.Disposable, ManagablePool
This is an Pool
that caches Poolable objects for reuse.
Please note that this pool offers no resource limiting whatsoever.
- Since:
- 4.1
- Version:
- CVS $Revision: 1.2 $ $Date: 2001/12/26 16:15:23 $
- Author:
- Berin Loritsch
Method Summary |
void |
dispose()
|
Poolable |
get()
|
void |
grow(int byNum,
long key)
Grow by the specified amount. |
void |
put(Poolable object)
|
void |
shrink(int byNum,
long key)
Shrink the pool by the specified amount. |
int |
size(long key)
Determine the pool's current size. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VariableSizePool
public VariableSizePool(ObjectFactory factory,
int size)
throws java.lang.Exception
- Constructor for an unmanaged pool
VariableSizePool
public VariableSizePool(ObjectFactory factory,
int size,
long key)
throws java.lang.Exception
- Constructor for a managed pool
get
public Poolable get()
- Specified by:
get
in interface Pool
put
public void put(Poolable object)
- Specified by:
put
in interface Pool
dispose
public void dispose()
- Specified by:
dispose
in interface org.apache.avalon.framework.activity.Disposable
shrink
public void shrink(int byNum,
long key)
throws java.lang.IllegalAccessException
- Description copied from interface:
ManagablePool
- Shrink the pool by the specified amount. The pool should trust the
Controller, but be smart enough not to achieve a negative pool size.
In other words, you should clip the shrink amount so that the pool does
not go below 0.
- Specified by:
shrink
in interface ManagablePool
- Following copied from interface:
org.apache.avalon.excalibur.pool.ManagablePool
- Parameters:
amount
- an integer amount to decrease the pool size by.key
- an integer number supplied by the PoolManager to validate
that the method is called legitimately- Throws:
java.lang.IllegalAccessException
- if the key does not match the controller's
key.
grow
public void grow(int byNum,
long key)
throws java.lang.IllegalAccessException
- Description copied from interface:
ManagablePool
- Grow by the specified amount. The pool should trust the Controller for
the Grow size.
- Specified by:
grow
in interface ManagablePool
- Following copied from interface:
org.apache.avalon.excalibur.pool.ManagablePool
- Parameters:
amount
- an integer amount to increase the pool size by.key
- an integer number supplied by the PoolManager to validate
that the method is called legitimately- Throws:
java.lang.IllegalAccessException
- if the key does not match the controller's
key.
size
public int size(long key)
throws java.lang.IllegalAccessException
- Description copied from interface:
ManagablePool
- Determine the pool's current size. The size is defined as the number of
Poolable objects in reserve.
- Specified by:
size
in interface ManagablePool
- Following copied from interface:
org.apache.avalon.excalibur.pool.ManagablePool
- Parameters:
key
- an integer number supplied by the PoolManager to validate
that the method is called legitimately- Returns:
- size of pool's reserve.
- Throws:
java.lang.IllegalAccessException
- if the key does not match the controller's
key.
Copyright © 2001 Apache Jakarta Project. All Rights Reserved.