public class ConnectionPoolUtil extends Object
Constructor and Description |
---|
ConnectionPoolUtil() |
Modifier and Type | Method and Description |
---|---|
com.saperion.connector.authentication.Session |
borrowObject(com.lexmark.saperion.remote.common.authentication.Credentials key)
Borrows an object from the keyed pool associated with the given key.
|
static org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig |
buildPoolConfig(Properties poolConfiguration) |
void |
clearPool()
Clears the used object poolUtil.
|
org.apache.commons.pool2.impl.GenericKeyedObjectPool<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session> |
getObjectPool()
Gets the object pool.
|
void |
initialize(org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig poolConfiguration,
Properties saperionProperties)
Initializes the pool with the given configurations and properties.
|
void |
initialize(org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig poolConfiguration,
String saperionPropertiesPath)
Initializes the pool with the given configurations and properties.
|
void |
initialize(Properties configuration)
C'tor taking the pool- and saperion classic connector configuration as combined
Properties object. |
void |
initialize(Properties poolConfiguration,
Properties saperionProperties)
Initializes the pool with the given configurations and properties.
|
void |
initialize(Properties poolConfiguration,
String saperionPropertiesPath)
Initializes the pool with the given configurations and properties.
|
void |
logStatisticPeriodically(String poolName,
long initDelay,
long period,
TimeUnit unit)
INFO-logs the pool statistics periodically in an extra Thread.
|
void |
printPoolStatistic()
Prints the pool statistic.
|
void |
returnObject(com.lexmark.saperion.remote.common.authentication.Credentials key,
com.saperion.connector.authentication.Session value)
Returns an object to a keyed pool.
|
void |
shutdown()
Closes the poolUtil.
|
public static org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig buildPoolConfig(Properties poolConfiguration)
public void initialize(Properties poolConfiguration, String saperionPropertiesPath) throws Exception
poolConfiguration
- The Properties object which is used to build the poolUtil configuration.saperionPropertiesPath
- the path to the configuration filesException
- if an error occurs.public void initialize(org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig poolConfiguration, String saperionPropertiesPath) throws Exception
poolConfiguration
- The pool configuration object.saperionPropertiesPath
- the path to the configuration filesException
- if an error occurs.public void initialize(Properties poolConfiguration, Properties saperionProperties) throws Exception
poolConfiguration
- The pool configuration object.saperionProperties
- the classic connector configurationException
- if an error occurs.public void initialize(org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig poolConfiguration, Properties saperionProperties) throws Exception
poolConfiguration
- The pool configuration object.saperionProperties
- the classic connector configurationException
- if an error occurs.public void initialize(Properties configuration)
Properties
object.configuration
- the pool- and saperion classic connector configuration.public void clearPool() throws FactoryException
FactoryException
- if an connection factory failure occurs.public void shutdown() throws FactoryException
FactoryException
- if an connection factory failure occurs.public org.apache.commons.pool2.impl.GenericKeyedObjectPool<com.lexmark.saperion.remote.common.authentication.Credentials,com.saperion.connector.authentication.Session> getObjectPool()
public void printPoolStatistic()
public void logStatisticPeriodically(String poolName, long initDelay, long period, TimeUnit unit)
poolName
- initDelay
- period
- unit
- public com.saperion.connector.authentication.Session borrowObject(com.lexmark.saperion.remote.common.authentication.Credentials key) throws Exception
key
- the key to identify the objectSession
) associated with the keyException
- when make object throws an exceptionGenericKeyedObjectPool.borrowObject(Object)
public void returnObject(com.lexmark.saperion.remote.common.authentication.Credentials key, com.saperion.connector.authentication.Session value) throws Exception
key
- the objects keyvalue
- the object (Session
) to returnException
- when returning the session failedCopyright © 2020 Hyland Software Germany GmbH. All rights reserved.