public class CommonsPoolObjectPool extends Object implements ObjectPool
CommonsPoolProxyPool
is an implementation of ObjectPool
that internally uses the commons-pool GenericObjectPool
and uses a
ObjectFactory
for creating new pooled instances.Modifier and Type | Field and Description |
---|---|
protected static Log |
logger
logger used by this class
|
protected MuleContext |
muleContext |
protected ObjectFactory |
objectFactory
The ObjectFactory used to create new pool instances
|
protected org.apache.commons.pool.impl.GenericObjectPool |
pool
The pool
|
protected PoolingProfile |
poolingProfile
The pooling profile used to configure and initialise pool
|
PHASE_NAME
PHASE_NAME
Constructor and Description |
---|
CommonsPoolObjectPool(ObjectFactory objectFactory,
PoolingProfile poolingProfile,
MuleContext muleContext)
Creates a new pool and an Object factory with the ServiceDescriptor
|
Modifier and Type | Method and Description |
---|---|
protected void |
applyInitialisationPolicy() |
Object |
borrowObject() |
void |
clear() |
void |
close() |
void |
dispose()
A lifecycle method where implementor should free up any resources.
|
int |
getMaxActive() |
int |
getNumActive() |
ObjectFactory |
getObjectFactory() |
protected org.apache.commons.pool.PoolableObjectFactory |
getPooledObjectFactory()
Template method to be overridden by implementations that do more than just
invoke objectFactory
|
void |
initialise()
Method used to perform any initialisation work.
|
void |
returnObject(Object object) |
void |
setObjectFactory(ObjectFactory objectFactory) |
protected static final Log logger
protected org.apache.commons.pool.impl.GenericObjectPool pool
protected ObjectFactory objectFactory
protected PoolingProfile poolingProfile
protected MuleContext muleContext
public CommonsPoolObjectPool(ObjectFactory objectFactory, PoolingProfile poolingProfile, MuleContext muleContext)
public void initialise() throws InitialisationException
Initialisable
InitialisationException
should be thrown,
causing the Mule instance to shutdown. If the error is recoverable, say by
retrying to connect, a RecoverableException
should be thrown.
There is no guarantee that by throwing a Recoverable exception that the Mule
instance will not shut down.initialise
in interface Initialisable
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdownRecoverableException
- if an error occurs that can be recovered fromprotected org.apache.commons.pool.PoolableObjectFactory getPooledObjectFactory()
protected void applyInitialisationPolicy() throws Exception
Exception
public Object borrowObject() throws Exception
borrowObject
in interface ObjectPool
Exception
public void returnObject(Object object)
returnObject
in interface ObjectPool
public int getNumActive()
getNumActive
in interface ObjectPool
public int getMaxActive()
getMaxActive
in interface ObjectPool
public void dispose()
Disposable
dispose
in interface Disposable
public void clear()
clear
in interface ObjectPool
public void close()
close
in interface ObjectPool
public void setObjectFactory(ObjectFactory objectFactory)
setObjectFactory
in interface ObjectPool
public ObjectFactory getObjectFactory()
getObjectFactory
in interface ObjectPool
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.