public class ConnectionFactory extends Object implements ViburObjectFactory
ViburDBCPDataSource.
This ConnectionFactory is a versioned factory which creates versioned JDBC Connection
wrappers ConnHolder(s). The version of each ConnHolder created by the factory is the same
as the version of the factory at the moment of the object creation.
Hook,
DefaultHook| Constructor and Description |
|---|
ConnectionFactory(ViburConfig config)
Instantiates this object factory.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
compareAndSetVersion(int expect,
int update)
Atomically sets the version value to the given updated value
if the current value
== the expected value. |
ConnHolder |
create() |
ConnHolder |
create(Connector connector)
Creates a new
ConnHolder object using the given connector. |
void |
destroy(ConnHolder connHolder) |
boolean |
readyToRestore(ConnHolder connHolder) |
boolean |
readyToTake(ConnHolder connHolder) |
int |
version()
Gets the current version value.
|
public ConnectionFactory(ViburConfig config) throws ViburDBCPException
config - the ViburConfig from which will initializeViburDBCPException - if cannot successfully initialize/configure the underlying SQL systempublic ConnHolder create() throws ViburDBCPException
ViburObjectFactorycreate in interface ViburObjectFactorycreate in interface org.vibur.objectpool.PoolObjectFactory<ConnHolder>ViburDBCPException - if cannot create or initialize the raw JDBC Connectionpublic ConnHolder create(Connector connector) throws ViburDBCPException
ViburObjectFactoryConnHolder object using the given connector. This object is presumed to be
ready (and valid) for immediate use. This method never return null.create in interface ViburObjectFactoryconnector - the JDBC connector; it contains the database credentialsViburDBCPException - if cannot create or initialize the raw JDBC Connectionpublic boolean readyToTake(ConnHolder connHolder)
readyToTake in interface org.vibur.objectpool.PoolObjectFactory<ConnHolder>public boolean readyToRestore(ConnHolder connHolder)
readyToRestore in interface org.vibur.objectpool.PoolObjectFactory<ConnHolder>public void destroy(ConnHolder connHolder)
destroy in interface org.vibur.objectpool.PoolObjectFactory<ConnHolder>public int version()
ViburObjectFactoryversion in interface ViburObjectFactorypublic boolean compareAndSetVersion(int expect,
int update)
ViburObjectFactory== the expected value.compareAndSetVersion in interface ViburObjectFactoryexpect - the expected version valueupdate - the new version valueCopyright © 2013-2019 vibur.org. All Rights Reserved.