com.c5corp.c5utm
Class UpdateConnectionPool

java.lang.Object
  extended by com.c5corp.c5utm.UpdateConnectionPool

public class UpdateConnectionPool
extends java.lang.Object

Provides/manages a pool of java.sql.Connection objects capable of updating the database


Method Summary
 void finalize()
           
 void freeConnection(java.sql.Connection con)
          returns a connection back to the pool
 java.sql.Connection getConnection()
          Returns a connection from the connection pool
static UpdateConnectionPool getInstance()
          Gets an instance of ConnectionPool - which is a singleton object containing Connections.
static UpdateConnectionPool getInstance(int poolSize)
          Gets an instance of ConnectionPool - which is a singleton object containing Connections.
 int getPoolSize()
          Returns the size of the connection pool
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static UpdateConnectionPool getInstance()
Gets an instance of ConnectionPool - which is a singleton object containing Connections. This method will return a pool with N number of connections depending on whether the pool is new or not. If it is not, the pool will contain three connections.

Returns:
a ConnectionPool
See Also:
getPoolSize()

getInstance

public static UpdateConnectionPool getInstance(int poolSize)
Gets an instance of ConnectionPool - which is a singleton object containing Connections. This method will return a pool with poolSize number of connections if it is the first time it is being called. Otherwise, the singleton will have the number it was originally created with.

Parameters:
poolSize - the size of the desired pool
Returns:
a ConnectionPool
See Also:
getPoolSize()

getPoolSize

public int getPoolSize()
Returns the size of the connection pool

Returns:
the size of the pool

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Returns a connection from the connection pool

Returns:
a connection
Throws:
java.sql.SQLException - if the pool is empty

freeConnection

public void freeConnection(java.sql.Connection con)
returns a connection back to the pool

Parameters:
con - the connection to return to the pool

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object