|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.avalon.excalibur.component.AbstractDualLogEnabled
org.apache.avalon.excalibur.component.AbstractDualLogEnabledInstrumentable
org.apache.avalon.excalibur.component.ComponentHandler
org.apache.avalon.excalibur.component.PoolableComponentHandler
The PoolableComponentHandler to make sure that poolable components are initialized destroyed and pooled correctly.
Components which implement Poolable may be configured to be pooled using the following example configuration. This example assumes that the user component class MyComp implements Poolable.
Configuration Example:
<my-comp pool-max="8" pool-max-strict="false" pool-blocking="true" pool-timeout="0" pool-trim-interval="0"/>
Roles Example:
<role name="com.mypkg.MyComponent" shorthand="my-comp" default-class="com.mypkg.DefaultMyComponent"/>
Configuration Attributes:
pool-max
attribute is used to set the maximum number of components which
will be pooled. See the pool-max-strict
and pool-blocking
attributes. (Defaults to "8")pool-max-strict
attribute is used to configure whether the Component
Manager should allow more than pool-max
Poolables to be looked up at the same
time. Setting this to true will throw an exception if the pool-blocking
attribute
is false. A value of false will allow additional instances of the Component to be created
to serve requests, but the additional instances will not be pooled. (Defaults to "false")
pool-blocking
attributes is used to configure whether the Component Manager
should block or throw an Exception when more than pool-max
Poolables are looked
up at the same time. Setting this to true will cause requests to block until another thread
releases a Poolable back to the Component Manager. False will cause an exception to be thrown.
This attribute is ignored if pool-max-strict
is false. (Defaults to "true")pool-timeout
attribute is used to specify the maximum amount of time in
milliseconds that a lookup will block for if Poolables are unavailable. If the timeout expires
before another thread releases a Poolable back to the Component Managaer then an Exception
will be thrown. A value of "0" specifies that the block will never timeout.
(Defaults to "0")pool-trim-interval
attribute is used to
specify, in milliseconds, how long idle Poolables will be
maintained in the pool before being closed. For a complete
explanation on how this works, see InstrumentedResourceLimitingPool.trim()
(Defaults to "0", trimming disabled)pool-min
and pool-grow
attributes
were deprecated as the underlying Pool (InstrumentedResourceLimitingPool
) does not
make use of them. Configurations which still use these attributes
will continue to function however, a minimum pool size is no longer
applicable.
Field Summary | |
static int |
DEFAULT_MAX_POOL_SIZE
Deprecated. The default max size of the pool |
Fields inherited from interface org.apache.excalibur.instrument.Instrumentable |
EMPTY_INSTRUMENT_ARRAY, EMPTY_INSTRUMENTABLE_ARRAY |
Constructor Summary | |
|
PoolableComponentHandler(DefaultComponentFactory factory,
Configuration config)
Deprecated. Create a PoolableComponentHandler which manages a pool of Components created by the specified factory object. |
protected |
PoolableComponentHandler(java.lang.String role,
java.lang.Class componentClass,
Configuration config,
ComponentManager manager,
Context context,
RoleManager roles,
LogkitLoggerManager logkit)
Deprecated. Create a ComponentHandler that takes care of hiding the details of whether a Component is ThreadSafe, Poolable, or SingleThreaded. |
Method Summary | |
void |
dispose()
Deprecated. Dispose of the ComponentHandler and any associated Pools and Factories. |
protected Component |
doGet()
Deprecated. Get a reference of the desired Component |
protected void |
doPut(Component component)
Deprecated. Return a reference of the desired Component |
void |
initialize()
Deprecated. Initialize the ComponentHandler. |
Methods inherited from class org.apache.avalon.excalibur.component.ComponentHandler |
canBeDisposed, get, getComponentHandler, getComponentHandler, getComponentHandler, getComponentHandler, getComponentHandler, put |
Methods inherited from class org.apache.avalon.excalibur.component.AbstractDualLogEnabledInstrumentable |
addChildInstrumentable, addInstrument, getChildInstrumentables, getInstrumentableName, getInstruments, setInstrumentableName |
Methods inherited from class org.apache.avalon.excalibur.component.AbstractDualLogEnabled |
getLogkitLogger, setLogger |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT_MAX_POOL_SIZE
Constructor Detail |
protected PoolableComponentHandler(java.lang.String role, java.lang.Class componentClass, Configuration config, ComponentManager manager, Context context, RoleManager roles, LogkitLoggerManager logkit) throws java.lang.Exception
public PoolableComponentHandler(DefaultComponentFactory factory, Configuration config) throws java.lang.Exception
factory
- The factory object which is responsible for creating the components
managed by the ComponentHandler.config
- The configuration to use to configure the pool.Method Detail |
public void initialize()
protected Component doGet() throws java.lang.Exception
doGet
in class ComponentHandler
Component
value
java.lang.Exception
- if an error occursprotected void doPut(Component component)
doPut
in class ComponentHandler
component
- a Component
valuepublic void dispose()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |