org.exolab.jms.persistence
Class AbstractConnectionManager

java.lang.Object
  |
  +--org.exolab.jms.persistence.AbstractConnectionManager
All Implemented Interfaces:
DBConnectionManager
Direct Known Subclasses:
DBCPConnectionManager

public abstract class AbstractConnectionManager
extends java.lang.Object
implements DBConnectionManager

All concrete DBConnectionManager instances can extend this class.

Version:
$Revision: 1.1 $ $Date: 2004/11/26 01:50:44 $
Author:
Jim Alateras
See Also:
DBConnectionManager

Constructor Summary
AbstractConnectionManager()
           
 
Method Summary
 java.lang.String getDriver()
          Returns the JDBC driver class name
 long getEvictionInterval()
          Returns the interval between checking idle connections for eviction.
 int getMaxActive()
          Returns the maximum number of active connections that can be allocated from this pool at the same time.
 int getMaxIdle()
          Returns the maximum number of connections that can sit idle in the connection pool, before connections are evicted.
 long getMinIdleTime()
          Returns the minimum time that a connection may remain idle before it may be evicted
 java.lang.String getPassword()
          Returns the user's password
 boolean getTestBeforeUse()
          Returns if connections should be tested before use.
 java.lang.String getTestQuery()
          Returns the SQL query to validate connections.
 java.lang.String getURL()
          Returns the JDBC URL
 java.lang.String getUser()
          Returns the user's name
 void setDriver(java.lang.String driver)
          Sets the JDBC driver class name
 void setEvictionInterval(long interval)
          Sets the interval between checking idle connections for eviction.
 void setMaxActive(int active)
          Sets the maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit.
 void setMaxIdle(int idle)
          Sets the maximum number of connections that can sit idle in the connection pool, before connections are evicted.
 void setMinIdleTime(long time)
          Sets the minimum time that a connection may remain idle before it may be evicted, or zero for no eviction.
 void setPassword(java.lang.String password)
          Sets the user's password that is used to access the database
 void setTestBeforeUse(boolean test)
          Determines if connections should be tested before use.
 void setTestQuery(java.lang.String query)
          Specifies an SQL query to validate connections.
 void setURL(java.lang.String url)
          Sets the URL to the database
 void setUser(java.lang.String name)
          Sets the user name that is used to obtain the connection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.exolab.jms.persistence.DBConnectionManager
getConnection, init
 

Constructor Detail

AbstractConnectionManager

public AbstractConnectionManager()
Method Detail

setUser

public void setUser(java.lang.String name)
Sets the user name that is used to obtain the connection
Specified by:
setUser in interface DBConnectionManager
Parameters:
name - the user name

getUser

public java.lang.String getUser()
Returns the user's name
Returns:
the user's name

setPassword

public void setPassword(java.lang.String password)
Sets the user's password that is used to access the database
Specified by:
setPassword in interface DBConnectionManager
Parameters:
password - the user's password

getPassword

public java.lang.String getPassword()
Returns the user's password
Returns:
the user's password

setDriver

public void setDriver(java.lang.String driver)
Sets the JDBC driver class name
Specified by:
setDriver in interface DBConnectionManager
Parameters:
driver - the JDBC driver class name

getDriver

public java.lang.String getDriver()
Returns the JDBC driver class name
Returns:
the JDBC driver class name

setURL

public void setURL(java.lang.String url)
Sets the URL to the database
Specified by:
setURL in interface DBConnectionManager
Parameters:
url - the JDBC URL

getURL

public java.lang.String getURL()
Returns the JDBC URL
Returns:
the JDBC URL

setMaxActive

public void setMaxActive(int active)
Sets the maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit.
Specified by:
setMaxActive in interface DBConnectionManager
Parameters:
active - the maximum number of active connections

getMaxActive

public int getMaxActive()
Returns the maximum number of active connections that can be allocated from this pool at the same time.
Returns:
the maximum number of active connections

setMaxIdle

public void setMaxIdle(int idle)
Sets the maximum number of connections that can sit idle in the connection pool, before connections are evicted.
Specified by:
setMaxIdle in interface DBConnectionManager
Parameters:
idle - the maximum number of idle connections

getMaxIdle

public int getMaxIdle()
Returns the maximum number of connections that can sit idle in the connection pool, before connections are evicted.
Returns:
the maximum number of idle connections

setMinIdleTime

public void setMinIdleTime(long time)
Sets the minimum time that a connection may remain idle before it may be evicted, or zero for no eviction.
Specified by:
setMinIdleTime in interface DBConnectionManager
Parameters:
time - the idle time, in seconds

getMinIdleTime

public long getMinIdleTime()
Returns the minimum time that a connection may remain idle before it may be evicted
Returns:
the minimum idle time, in seconds

setEvictionInterval

public void setEvictionInterval(long interval)
Sets the interval between checking idle connections for eviction. Idle connections are removed after setMinIdleTime(long) seconds, or if {@ link #testQuery} is specified, and the query fails.
Specified by:
setEvictionInterval in interface DBConnectionManager
Parameters:
interval - the eviction interval, in seconds

getEvictionInterval

public long getEvictionInterval()
Returns the interval between checking idle connections for eviction.
Returns:
the eviction interval, in seconds

setTestQuery

public void setTestQuery(java.lang.String query)
Specifies an SQL query to validate connections. This query should return at least one row, and be fast to execute.
Specified by:
setTestQuery in interface DBConnectionManager
Parameters:
query - the test query

getTestQuery

public java.lang.String getTestQuery()
Returns the SQL query to validate connections.
Returns:
the test query

setTestBeforeUse

public void setTestBeforeUse(boolean test)
Determines if connections should be tested before use. If true, each connection is tested before being returned. If a connection fails, it is discarded, and another connection allocated. This ensures a higher reliability, at the cost of performance.
Specified by:
setTestBeforeUse in interface DBConnectionManager
Parameters:
test - if true, each connection is tested use.

getTestBeforeUse

public boolean getTestBeforeUse()
Returns if connections should be tested before use.
Returns:
true if each connection should be tested before being used.


Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.