APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.utils

public Class ObjectPool

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
com.sun.org.apache.xalan.internal.utils.ObjectFactory, com.sun.org.apache.xml.internal.res.XMLErrorResources, .XMLMessages, java.lang.reflect.InvocationTargetException, java.util.ArrayList, .List

Pool of object of a given type to pick from to help memory usage

Field Summary

Modifier and TypeField and Description
private final List<Object>
freeStack

Stack of given objects this points to.

private final Class<?>
objectType

Type of objects in this pool.

pack-priv static final long

Constructor Summary

AccessConstructor and Description
public
ObjectPool(Class<?>
Type of objects for this pool
type
)

Constructor ObjectPool

public
ObjectPool(String
Fully qualified name of the type of objects for this pool.
className
)

Constructor ObjectPool

public
ObjectPool(Class<?>
Type of objects for this pool
type
,
int
Size of vector to allocate
size
)

Constructor ObjectPool

public
ObjectPool()

Constructor ObjectPool

Method Summary

Modifier and TypeMethod and Description
public synchronized void
freeInstance(Object
Object to add.
obj
)

Add an instance of the given object to the pool

public synchronized Object

Returns:

An instance of the given object
getInstance
()

Get an instance of the given object in this pool

public synchronized Object

Returns:

an instance of the given object if available or null
getInstanceIfFree
()

Get an instance of the given object in this pool if available

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

freeStackback to summary
private final List<Object> freeStack

Stack of given objects this points to.

Annotations
@SuppressWarnings:serial
objectTypeback to summary
private final Class<?> objectType

Type of objects in this pool.

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Constructor Detail

ObjectPoolback to summary
public ObjectPool(Class<?> type)

Constructor ObjectPool

Parameters
type:Class<?>

Type of objects for this pool

ObjectPoolback to summary
public ObjectPool(String className)

Constructor ObjectPool

Parameters
className:String

Fully qualified name of the type of objects for this pool.

ObjectPoolback to summary
public ObjectPool(Class<?> type, int size)

Constructor ObjectPool

Parameters
type:Class<?>

Type of objects for this pool

size:int

Size of vector to allocate

ObjectPoolback to summary
public ObjectPool()

Constructor ObjectPool

Method Detail

freeInstanceback to summary
public synchronized void freeInstance(Object obj)

Add an instance of the given object to the pool

Parameters
obj:Object

Object to add.

getInstanceback to summary
public synchronized Object getInstance()

Get an instance of the given object in this pool

Returns:Object

An instance of the given object

getInstanceIfFreeback to summary
public synchronized Object getInstanceIfFree()

Get an instance of the given object in this pool if available

Returns:Object

an instance of the given object if available or null