com.arsdigita.bebop
Class ComponentPool
java.lang.Object
com.arsdigita.bebop.ComponentPool
- public class ComponentPool
- extends Object
Component pool for recycling component instances. This is useful
for performance optimization, to limit object creation and garbage
collection for frequently used objects (Pages, Portlets, etc.)
A ComponentPool is a really set of individual pools for each
different class of component.
- Since:
- Version:
- $Id: //core-platform/dev/src/com/arsdigita/bebop/ComponentPool.java#11 $ $DateTime: 2004/04/07 16:07:11 $
- Author:
- Bob Donald, Bill Schneider
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
versionId
public static final String versionId
- See Also:
- Constant Field Values
ComponentPool
public ComponentPool()
getInstance
public static ComponentPool getInstance()
setPoolSize
public void setPoolSize(Class c,
int num)
- Sets the pool size for components of class
c
.
Instantiates enough objects to ensure that there will be
num
instances of that component available.
- Parameters:
c
- the component class to set the pool size fornum
- the minimum pool size for that class
getComponent
public Component getComponent(Class componentClass)
- Returns a component of class
componentClass
from the pool.
- Parameters:
componentClass
- the class of the component to return
- Returns:
- an instatnce of componentClass
returnToPool
public void returnToPool(Component c)
- Return the component to the pool of free components so it can
be reused. If the component was not pooled then this becomes a
no-op; it is harmless to return an unpooled component to the
pool.
Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC