com.softwareag.tamino.db.api.connection
Class TConnectionPoolImpl

java.lang.Object
  extended by com.softwareag.tamino.db.api.connection.TConnectionPoolImpl
All Implemented Interfaces:
TConnectionPool

public class TConnectionPoolImpl
extends java.lang.Object
implements TConnectionPool

TConnectionPool represents a pool of openned connections. The pool provides services to get and put back openned connections. When instantiated a connection pool initially holds a fixed but client specified number of openned connections for a specific database URI, user and password. Once the amount of checked out connections reaches this size new connections are automatically instantiated and put to the pool to a user given size of maximum connections. Each connection pool gets a logical name that can be used by a connection pool manager that basically manages a set of connection pools.

Version:
$Revision: 1.19 $
Author:
Marcus Schreyer

Constructor Summary
TConnectionPoolImpl(org.w3c.dom.Element element)
          It is recommend to no longer use this method.
TConnectionPoolImpl(java.lang.String name, TConnectionPoolDescriptor descriptor, boolean poolTaminoConnections, java.util.Locale locale)
          Intitializes the connection pool with a logical name.
 
Method Summary
 void deleteConnection(TPooledConnection connection)
          Deletes a pooled connection.
 TConnection getConnection()
          Gets a opened connection from the pool.
 TConnectionPoolDescriptor getDescriptor()
          Gets the TCOnnectionPoolDescriptor
 java.util.Locale getLocale()
          Gets the locale.
 java.lang.String getName()
          Gets the connection pools logical name.
 TConnectionPoolStatistics getStatistics()
          Method getStatistics
 void release()
          Releases all opened connections given within the pool.
 void retainConnection(TConnection connection)
          Retains the handed connection back to the pool.
 void setLocale(java.util.Locale locale)
          Sets the locale.
 java.lang.String toString()
          Shows the current status of the connection pool as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TConnectionPoolImpl

public TConnectionPoolImpl(java.lang.String name,
                           TConnectionPoolDescriptor descriptor,
                           boolean poolTaminoConnections,
                           java.util.Locale locale)
                    throws TServerNotAvailableException
Intitializes the connection pool with a logical name. The pool initially contains a fixed number of openned connections specified by initConnections. If this size is reached for checked out connections then the pool is dynamically increased up to maxConnections number of opened connections.

Throws:
TServerNotAvailableException

TConnectionPoolImpl

public TConnectionPoolImpl(org.w3c.dom.Element element)
                    throws TConnectionNotAvailableException
It is recommend to no longer use this method. Intitializes the connection pool from the given element. The element here contains all the properties as they are mentioned above. The element is supposed to represent the following tree structure.
 
 

Parameters:
element - describes the above XML tree structure.
Throws:
TConnectionNotAvailableException
Method Detail

getConnection

public TConnection getConnection()
                          throws TConnectionNotAvailableException
Gets a opened connection from the pool. If none are available due to the reached number of maximum connections an exception is thrown.

Specified by:
getConnection in interface TConnectionPool
Returns:
an opened TConnectionn instance.
Throws:
TConnectionNotAvailableException

deleteConnection

public void deleteConnection(TPooledConnection connection)
Deletes a pooled connection. This may become necessary when due some communication problem the underlying physical connection has become unusable ( !isHealthy() ). The pooled connection is simply not put back in the list of free ones.

Specified by:
deleteConnection in interface TConnectionPool
Parameters:
connection - a TConnectionWrapper

retainConnection

public void retainConnection(TConnection connection)
Retains the handed connection back to the pool. This operation is called implicitly when connection.close() is invoked on an opened connection obtained previously from this connection pool. It should never be called by client code directly!

Specified by:
retainConnection in interface TConnectionPool
Parameters:
connection - is the TConnection that should be put pack into the pool.

release

public void release()
Releases all opened connections given within the pool.

Specified by:
release in interface TConnectionPool

getName

public java.lang.String getName()
Gets the connection pools logical name.

Specified by:
getName in interface TConnectionPool
Returns:
the logical pool name.

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale.

Specified by:
setLocale in interface TConnectionPool

getLocale

public java.util.Locale getLocale()
Gets the locale.

Specified by:
getLocale in interface TConnectionPool
Returns:
the locale.

toString

public java.lang.String toString()
Shows the current status of the connection pool as a String.

Overrides:
toString in class java.lang.Object
Returns:
the current status of the connection pool as a String.

getStatistics

public TConnectionPoolStatistics getStatistics()
Description copied from interface: TConnectionPool
Method getStatistics

Specified by:
getStatistics in interface TConnectionPool
Returns:
a TConnectionPoolStatistics

getDescriptor

public TConnectionPoolDescriptor getDescriptor()
Description copied from interface: TConnectionPool
Gets the TCOnnectionPoolDescriptor

Specified by:
getDescriptor in interface TConnectionPool
Returns:
the TConnectioPoolDescriptor


Copyright (c) 2013 Software AG. All Rights Reserved.