com.ds.fw.dbcon
Class FwConnPool

java.lang.Object
  |
  +--com.ds.fw.dbcon.FwConnPool

public class FwConnPool
extends java.lang.Object


Field Summary
 long CONN_CHECK_TIME
          Connections Check Time in milliseconds The time interval used in the Thread tr to manage check the connection status.
 long CONN_DEFAUT_LIFETIME
          Default Life Time; if zero, then the connection has an infinite life time The lifetime is the time interval after the lastUsedTime after which the connection is killed.
 long CONN_DEFAUT_TIMEOUT
          Default Timeout.
 java.lang.String CONN_DRV
          The connection driver for the database connection
 java.lang.String CONN_PASS
          The connection password
 java.lang.String CONN_STR
          The connect string for the database connection
 java.lang.String CONN_TYPE
          The connection type
 java.lang.String CONN_USER
          The connection username
 int INCR_NO_OF_CONN
          next increment of available connections in the pool
 int INIT_NO_OF_CONN
          Initial number of available connections in the pool
 int MAX_NO_OF_CONN
          max number of connections in the pool
 
Constructor Summary
FwConnPool()
           
 
Method Summary
 void FwConnPool()
          Constructor of the FwConnPool class
 long getConnCheckTime()
          Returns the connection check time
 long getConnDefaultLifeTime()
          Return the connection default life time
 long getConnDefaultTimeout()
          Returns the default timeout for a connection before been returned to the connection pool
 java.lang.String getConnDrv()
          Returns the connection driver
 java.sql.Connection getConnection()
          Returns a connection from the connection pool
 java.lang.String getConnPass()
          Returns the user password
 java.lang.String getConnStr()
          Returns the connection string
 java.lang.String getConnType()
          Returns the Connection Type
 java.lang.String getConnUser()
          Returns the user name
 com.ds.fw.dbcon.FwDBConnection getDBConnection()
          Returns a FwDBConnection
 int getIncrNoOfConn()
          Returns the increment, by which the connections will be increased
 int getInitNoOfConn()
          Returns the initial number of connections
 int getMaxNoOfConn()
          Returns the maximum number of connections in the connection pool
 boolean killAllConn()
          Remove all connections from the connection pool
 boolean killConn(java.sql.Connection toBeKill)
          Remove a connection from the connection pool
 boolean killDBConn(int i)
          Remove a connection from the connection pool
 boolean releaseConn(java.sql.Connection toBeReleased)
          This method is used when releasing a connection
 boolean releaseDBConn(int i)
          This method is used to release a FwDBConnection
 void setConnCheckTime(long ConnCheckTime)
          Sets the connection check time in miliseconds
 void setConnDefaultLifeTime(long ConnDefaultLifeTime)
          Sets the default life time for the connection
 void setConnDefaultTimeout(long ConnDefaultTimeout)
          Sets the default timeout for a connection before been returned to the connection pool in case some problems occurs during the user session
 void setConnDrv(java.lang.String ConnDrv)
          Sets the connection driver
 void setConnPass(java.lang.String ConnPass)
          Sets the user password
 void setConnStr(java.lang.String ConnStr)
          Sets the connection string
 void setConnType(java.lang.String t)
          Sets the Connection Type
 void setConnUser(java.lang.String ConnUser)
          Sets the user name
 void setIncrNoOfConn(int IncrNoOfConn)
          Sets the number, by which the connections will be increased
 void setInitNoOfConn(int InitNoOfConn)
          Sets the initial number of connections.
 void setMaxNoOfConn(int MaxNoOfConn)
          Sets the maximum number of the connections in the connection pool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONN_STR

public java.lang.String CONN_STR
The connect string for the database connection


CONN_DRV

public java.lang.String CONN_DRV
The connection driver for the database connection


CONN_USER

public java.lang.String CONN_USER
The connection username


CONN_PASS

public java.lang.String CONN_PASS
The connection password


CONN_TYPE

public java.lang.String CONN_TYPE
The connection type


INIT_NO_OF_CONN

public int INIT_NO_OF_CONN
Initial number of available connections in the pool


INCR_NO_OF_CONN

public int INCR_NO_OF_CONN
next increment of available connections in the pool


MAX_NO_OF_CONN

public int MAX_NO_OF_CONN
max number of connections in the pool


CONN_CHECK_TIME

public long CONN_CHECK_TIME
Connections Check Time in milliseconds The time interval used in the Thread tr to manage check the connection status.


CONN_DEFAUT_LIFETIME

public long CONN_DEFAUT_LIFETIME
Default Life Time; if zero, then the connection has an infinite life time The lifetime is the time interval after the lastUsedTime after which the connection is killed.


CONN_DEFAUT_TIMEOUT

public long CONN_DEFAUT_TIMEOUT
Default Timeout. if zero, then the connection has infinite timeout The timeout is the total time the connection can be used, after that time it is released back to the connection pool.

Constructor Detail

FwConnPool

public FwConnPool()
Method Detail

setConnStr

public void setConnStr(java.lang.String ConnStr)
Sets the connection string

Parameters:
ConnStr - the connection string

getConnStr

public java.lang.String getConnStr()
Returns the connection string

Returns:
the connection string

setConnDrv

public void setConnDrv(java.lang.String ConnDrv)
Sets the connection driver

Parameters:
ConnDrv - the connection driver
See Also:
getConnDrv()

getConnDrv

public java.lang.String getConnDrv()
Returns the connection driver

Returns:
the connection driver
See Also:
setConnDrv(String)

setConnUser

public void setConnUser(java.lang.String ConnUser)
Sets the user name

Parameters:
ConnUser - the new user name
See Also:
getConnUser()

getConnUser

public java.lang.String getConnUser()
Returns the user name

Returns:
the connection user
See Also:
setConnUser(String)

setConnPass

public void setConnPass(java.lang.String ConnPass)
Sets the user password

Parameters:
ConnPass - the connection password

getConnPass

public java.lang.String getConnPass()
Returns the user password

Returns:
the connection password

getConnType

public java.lang.String getConnType()
Returns the Connection Type

Returns:
the connection Type

setConnType

public void setConnType(java.lang.String t)
Sets the Connection Type

Parameters:
t - the connection Type

setInitNoOfConn

public void setInitNoOfConn(int InitNoOfConn)
Sets the initial number of connections. When the number of connections grows up the initial number the number of connection could be increased with the INCR_NO_OF_CONN, untill the MAX_NO_OF_CONN is reached .

Parameters:
InitNoOfConn - the initial number of connections
See Also:
setIncrNoOfConn(int), getIncrNoOfConn(), setMaxNoOfConn(int), getMaxNoOfConn()

getInitNoOfConn

public int getInitNoOfConn()
Returns the initial number of connections

Returns:
the innitial number of connections
See Also:
setInitNoOfConn(int)

setIncrNoOfConn

public void setIncrNoOfConn(int IncrNoOfConn)
Sets the number, by which the connections will be increased

Parameters:
IncrNoOfConn - the new increment, by which the connections will be increased
See Also:
getIncrNoOfConn()

getIncrNoOfConn

public int getIncrNoOfConn()
Returns the increment, by which the connections will be increased

Returns:
the connection pool increment
See Also:
setIncrNoOfConn(int)

setMaxNoOfConn

public void setMaxNoOfConn(int MaxNoOfConn)
Sets the maximum number of the connections in the connection pool

Parameters:
MaxNoOfConn - the new number of connections
See Also:
getMaxNoOfConn()

getMaxNoOfConn

public int getMaxNoOfConn()
Returns the maximum number of connections in the connection pool

Returns:
the max number of connections
See Also:
setMaxNoOfConn(int)

setConnCheckTime

public void setConnCheckTime(long ConnCheckTime)
Sets the connection check time in miliseconds

Parameters:
ConnCheckTime - the connection check time

getConnCheckTime

public long getConnCheckTime()
Returns the connection check time

Returns:
the connection check time

setConnDefaultLifeTime

public void setConnDefaultLifeTime(long ConnDefaultLifeTime)
Sets the default life time for the connection

Parameters:
ConnDefaultLifeTime - the default life time in miliseconds

getConnDefaultLifeTime

public long getConnDefaultLifeTime()
Return the connection default life time

Returns:
the connection default life time in miliseconds

setConnDefaultTimeout

public void setConnDefaultTimeout(long ConnDefaultTimeout)
Sets the default timeout for a connection before been returned to the connection pool in case some problems occurs during the user session


getConnDefaultTimeout

public long getConnDefaultTimeout()
Returns the default timeout for a connection before been returned to the connection pool

Returns:
the default timeout in milliseconds

FwConnPool

public void FwConnPool()
Constructor of the FwConnPool class


getConnection

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

Returns:
a db connection from the pool as a Connection object

getDBConnection

public com.ds.fw.dbcon.FwDBConnection getDBConnection()
Returns a FwDBConnection

Returns:
a connection from the pool as a FwDBConnection

releaseConn

public boolean releaseConn(java.sql.Connection toBeReleased)
This method is used when releasing a connection

Parameters:
toBeReleased - a connection to be released(as a Connection object)
Returns:
true if the connection is released successfully

releaseDBConn

public boolean releaseDBConn(int i)
This method is used to release a FwDBConnection

Parameters:
i - the position in the vector of the connections
Returns:
: Always return true (if an exception does not stop the execution)

killConn

public boolean killConn(java.sql.Connection toBeKill)
Remove a connection from the connection pool

Parameters:
toBeKill - a connection to be removed
Returns:
true if successful

killDBConn

public boolean killDBConn(int i)
Remove a connection from the connection pool

Parameters:
i - the number of the connection in the vector of connections in the connection pool
Returns:
true if successful

killAllConn

public boolean killAllConn()
Remove all connections from the connection pool

Returns:
true if successful