org.csc.phynixx.connection
Class PooledPhynixxManagedConnectionFactory<C extends IPhynixxConnection>

java.lang.Object
  extended by org.csc.phynixx.connection.PhynixxManagedConnectionListenerAdapter<C>
      extended by org.csc.phynixx.connection.PhynixxManagedConnectionFactory<C>
          extended by org.csc.phynixx.connection.PooledPhynixxManagedConnectionFactory<C>
Type Parameters:
C - Typ of the pure connection
All Implemented Interfaces:
IPhynixxConnectionFactory<C>, IPhynixxManagedConnectionFactory<C>, IPhynixxManagedConnectionListener<C>

public class PooledPhynixxManagedConnectionFactory<C extends IPhynixxConnection>
extends PhynixxManagedConnectionFactory<C>

Factory pools the pure connection. before delivering the connection it ist decorate by the according to PhynixxManagedConnectionFactory.


Constructor Summary
PooledPhynixxManagedConnectionFactory()
           
PooledPhynixxManagedConnectionFactory(IPhynixxConnectionFactory connectionFactory)
           
PooledPhynixxManagedConnectionFactory(IPhynixxConnectionFactory<C> connectionFactory, org.apache.commons.pool2.impl.GenericObjectPoolConfig genericPoolConfig)
           
 
Method Summary
 void close()
          closes all currently opened connections
 void connectionFreed(IManagedConnectionEvent<C> event)
          the connection is set free an released from the pool
 void connectionReleased(IManagedConnectionEvent<C> event)
          the connection is sent back to the pool
 void freeConnection(IPhynixxManagedConnection<C> connection)
           
 Class<C> getConnectionInterface()
           
 IPhynixxManagedConnection<C> getManagedConnection()
          the returned connection has to be explicitly closed
 void releaseConnection(IPhynixxManagedConnection<C> connection)
          closes the connection an releases it to the pool
 void setGenericPoolConfig(org.apache.commons.pool2.impl.GenericObjectPoolConfig cfg)
          closes the current pool -if existing- and instanciates a new pool
 
Methods inherited from class org.csc.phynixx.connection.PhynixxManagedConnectionFactory
addManagedConnectionDecorator, getConnection, getConnectionFactory, getLoggerSystemStrategy, getManagedConnectionDecorators, instantiateConnection, isAutocommitAware, isSynchronizeConnection, setAutocommitAware, setConnectionFactory, setLoggerSystemStrategy, setSynchronizeConnection
 
Methods inherited from class org.csc.phynixx.connection.PhynixxManagedConnectionListenerAdapter
connectionCommitted, connectionCommitting, connectionErrorOccurred, connectionPrepared, connectionPreparing, connectionRecovered, connectionRecovering, connectionRequiresTransaction, connectionRequiresTransactionExecuted, connectionReset, connectionRolledback, connectionRollingBack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.csc.phynixx.connection.IPhynixxManagedConnectionListener
connectionCommitted, connectionCommitting, connectionErrorOccurred, connectionPrepared, connectionPreparing, connectionRecovered, connectionRecovering, connectionRequiresTransaction, connectionRequiresTransactionExecuted, connectionReset, connectionRolledback, connectionRollingBack
 

Constructor Detail

PooledPhynixxManagedConnectionFactory

public PooledPhynixxManagedConnectionFactory()

PooledPhynixxManagedConnectionFactory

public PooledPhynixxManagedConnectionFactory(IPhynixxConnectionFactory connectionFactory)

PooledPhynixxManagedConnectionFactory

public PooledPhynixxManagedConnectionFactory(IPhynixxConnectionFactory<C> connectionFactory,
                                             org.apache.commons.pool2.impl.GenericObjectPoolConfig genericPoolConfig)
Method Detail

setGenericPoolConfig

public void setGenericPoolConfig(org.apache.commons.pool2.impl.GenericObjectPoolConfig cfg)
                          throws Exception
closes the current pool -if existing- and instanciates a new pool

Parameters:
cfg -
Throws:
Exception

getManagedConnection

public IPhynixxManagedConnection<C> getManagedConnection()
Description copied from interface: IPhynixxManagedConnectionFactory
the returned connection has to be explicitly closed

Specified by:
getManagedConnection in interface IPhynixxManagedConnectionFactory<C extends IPhynixxConnection>
Overrides:
getManagedConnection in class PhynixxManagedConnectionFactory<C extends IPhynixxConnection>
Returns:
a ready for use managed connection

releaseConnection

public void releaseConnection(IPhynixxManagedConnection<C> connection)
closes the connection an releases it to the pool

Parameters:
connection -

freeConnection

public void freeConnection(IPhynixxManagedConnection<C> connection)

close

public void close()
Description copied from interface: IPhynixxManagedConnectionFactory
closes all currently opened connections

Specified by:
close in interface IPhynixxConnectionFactory<C extends IPhynixxConnection>
Specified by:
close in interface IPhynixxManagedConnectionFactory<C extends IPhynixxConnection>
Overrides:
close in class PhynixxManagedConnectionFactory<C extends IPhynixxConnection>

getConnectionInterface

public Class<C> getConnectionInterface()
Specified by:
getConnectionInterface in interface IPhynixxConnectionFactory<C extends IPhynixxConnection>
Overrides:
getConnectionInterface in class PhynixxManagedConnectionFactory<C extends IPhynixxConnection>
Returns:
the class of the connection's interface

connectionReleased

public void connectionReleased(IManagedConnectionEvent<C> event)
the connection is sent back to the pool

Specified by:
connectionReleased in interface IPhynixxManagedConnectionListener<C extends IPhynixxConnection>
Overrides:
connectionReleased in class PhynixxManagedConnectionFactory<C extends IPhynixxConnection>
Parameters:
event - current connection

connectionFreed

public void connectionFreed(IManagedConnectionEvent<C> event)
the connection is set free an released from the pool

Specified by:
connectionFreed in interface IPhynixxManagedConnectionListener<C extends IPhynixxConnection>
Overrides:
connectionFreed in class PhynixxManagedConnectionFactory<C extends IPhynixxConnection>


Copyright © 2015. All rights reserved.