All Packages Class Hierarchy This Package Previous Next Index
Class sun.servlet.util.Pool
java.lang.Object
|
+----sun.servlet.util.Pool
- public class Pool
- extends Object
This class implements a simple resource allocation pool for storing
reusable objects.
-
cl
- The Class used to create new objects.
-
count
- The current number of available objects.
-
free
- The list of available objects.
-
Pool(Class)
- Creates a new allocation pool for the specified Class.
-
Pool(Class, int)
- Creates a new allocation pool for the specified Class.
-
Pool(String)
- Creates a new allocation pool for the specified class name.
-
Pool(String, int)
- Creates a new allocation pool for the specified class name.
-
alloc()
- Returns a new object from the allocation pool.
-
free(Object)
-
Returns an object to the free list.
-
init(Class)
- Initializes allocation pool for the specified Class.
cl
protected Class cl
- The Class used to create new objects.
free
protected Object free[]
- The list of available objects.
count
protected int count
- The current number of available objects.
Pool
public Pool(String name,
int count) throws IllegalArgumentException
- Creates a new allocation pool for the specified class name.
- Parameters:
- name - the name of the class used for creating new objects
- count - the initial size of the allocation pool
- Throws: IllegalArgumentException
- if the class could not be found,
could not be instantiated, or the class or initializer is
not accessible
Pool
public Pool(String name) throws IllegalArgumentException
- Creates a new allocation pool for the specified class name.
- Parameters:
- name - the name of the class used for creating new objects
- Throws: IllegalArgumentException
- if the class could not be found,
could not be instantiated, or the class or initializer is
not accessible
Pool
public Pool(Class cl,
int count) throws IllegalArgumentException
- Creates a new allocation pool for the specified Class.
- Parameters:
- cl - the Class used for creating new objects
- Throws: IllegalArgumentException
- if the class could not be
instantiated, or the class or initializer is not accessible
Pool
public Pool(Class cl) throws IllegalArgumentException
- Creates a new allocation pool for the specified Class.
- Parameters:
- cl - the Class used for creating new objects
- Throws: IllegalArgumentException
- if the class could not be
instantiated, or the class or initializer is not accessible
init
protected void init(Class cl) throws IllegalArgumentException
- Initializes allocation pool for the specified Class.
- Parameters:
- cl - the Class used for creating new objects
- Throws: IllegalArgumentException
- if the class could not be
instantiated, or the class or initializer is not accessible
alloc
public Object alloc()
- Returns a new object from the allocation pool. If an object is not
currently available from the free list, then a new one will be created
using the Class specified in the constructor.
free
public synchronized void free(Object obj)
- Returns an object to the free list. The object must be an instance
of the Class specified when the pool was created.
- Parameters:
- obj - the object to be freed
All Packages Class Hierarchy This Package Previous Next Index