java.lang.Object
org.mortbay.util.Pool
- All Implemented Interfaces:
- LifeCycle, java.io.Serializable
- public class Pool
- extends java.lang.Object
- implements LifeCycle, java.io.Serializable
A pool of Objects.
- Version:
- $Id: Pool.java,v 1.9 2003/10/31 12:17:19 gregwilkins Exp $
|
Constructor Summary |
Pool()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
private static org.apache.commons.logging.Log log
__max
static int __max
__min
static int __min
__nameMap
static java.util.HashMap __nameMap
_max
private int _max
_min
private int _min
_name
private java.lang.String _name
_className
private java.lang.String _className
_maxIdleTimeMs
private int _maxIdleTimeMs
_attributes
private java.util.HashMap _attributes
_class
private transient java.lang.Class _class
_pondLife
private transient Pool.PondLife[] _pondLife
_index
private transient int[] _index
_size
private transient int _size
_available
private transient int _available
_running
private transient int _running
Pool
public Pool()
getPool
public static Pool getPool(java.lang.String name)
getPoolName
public java.lang.String getPoolName()
setPoolName
public void setPoolName(java.lang.String name)
throws java.lang.IllegalStateException
setPoolClass
public void setPoolClass(java.lang.Class poolClass)
throws java.lang.IllegalStateException
- Set the class.
getPoolClass
public java.lang.Class getPoolClass()
getMinSize
public int getMinSize()
setMinSize
public void setMinSize(int min)
getMaxSize
public int getMaxSize()
setMaxSize
public void setMaxSize(int max)
getMaxIdleTimeMs
public int getMaxIdleTimeMs()
setMaxIdleTimeMs
public void setMaxIdleTimeMs(int maxIdleTimeMs)
setAttribute
public void setAttribute(java.lang.String name,
java.lang.Object value)
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
isStarted
public boolean isStarted()
- Specified by:
isStarted in interface LifeCycle
size
public int size()
available
public int available()
start
public void start()
throws java.lang.Exception
- Description copied from interface:
LifeCycle
- Start the LifeCycle.
- Specified by:
start in interface LifeCycle
stop
public void stop()
throws java.lang.InterruptedException
- Description copied from interface:
LifeCycle
- Stop the LifeCycle.
The LifeCycle may wait for current activities to complete
normally, but it can be interrupted.
- Specified by:
stop in interface LifeCycle
get
public Pool.PondLife get(int timeoutMs)
throws java.lang.Exception
put
public void put(Pool.PondLife pl)
throws java.lang.InterruptedException
shrink
public void shrink()
throws java.lang.InterruptedException
reservePondLife
private int reservePondLife(boolean available)
throws java.lang.Exception
newPondLife
private Pool.PondLife newPondLife(int id)
throws java.lang.Exception
newPondLife
private Pool.PondLife newPondLife()
throws java.lang.Exception
closePondLife
private void closePondLife(int id)
stopPondLife
private void stopPondLife(int id)
dump
public void dump(java.lang.String msg)
readObject
private void readObject(java.io.ObjectInputStream in)
throws java.io.IOException,
java.lang.ClassNotFoundException