Java Doc for AbstractConnectionManager.java in  » Database-JDBC-Connection-Pool » sequoia-2.10.9 » org » continuent » sequoia » controller » connection » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » sequoia 2.10.9 » org.continuent.sequoia.controller.connection 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.continuent.sequoia.controller.connection.AbstractConnectionManager

All known Subclasses:   org.continuent.sequoia.controller.connection.AbstractPoolConnectionManager,  org.continuent.sequoia.controller.connection.SimpleConnectionManager,
AbstractConnectionManager
abstract public class AbstractConnectionManager implements XmlComponent,Cloneable(Code)
A ConnectionManager object is responsible to talk directly with a database backend.
author:
   Emmanuel Cecchet
author:
   Mathieu Peltier
author:
   Nicolas Modrzyk
author:
   Stephane Giron
version:
   1.0

Inner Class :class IdlePersistentConnectionsPingerThread extends Thread

Field Summary
protected  StringbackendName
     Name of the DatabaseBackend owning this connection manager.
protected  StringbackendUrl
     URL of the DatabaseBackend owning this connection manager.
protected  StringconnectionTestStatement
    
protected  StringdriverClassName
    
protected  StringdriverPath
    
protected  intidlePersistentConnectionPingInterval
     Time after which an idle persistent connection will be checked.
protected  booleanidlePersistentConnectionPingRunning
     Indicates if the idle persistent connections checker thread is running.
protected  LinkedListidlePersistentConnections
    
protected  booleaninitialized
     true if the connection pool has been initialized.
protected  booleanisShutdown
     true if the connection manager has been shutdown and should no longer hand out Connections.
static  Tracelogger
     Logger instance.
protected  IdlePersistentConnectionsPingerThreadpersistentConnectionPingerThread
     Allow to check idle persistent connections against the backend.
protected transient  HashtablepersistentConnections
     Hashtable<Long, PooledConnection> which associates a persistent connection id (encapsulated in a Long) with a PooledConnection.
protected  LinkedListpersistentConnectionsIdleTime
     Stores the time on which persistent connections have been last used.
protected  StringrLogin
     Backend connection login to be used by this connection manager.
protected  StringrPassword
     Backend connection password to be used by this connection manager.

Constructor Summary
protected  AbstractConnectionManager(String backendUrl, String backendName, String rLogin, String rPassword, String driverPath, String driverClassName)
     Creates a new AbstractConnectionManager instance: assigns login/password and instanciates transaction id/connection mapping.

Method Summary
abstract protected  Objectclone()
    
abstract public  AbstractConnectionManagerclone(String rLogin, String rPassword)
     Creates a new connection manager with the same parameters but a different backend user and password.
protected  voidcloseConnection(PooledConnection connection)
     Close an unwanted connection.
public  AbstractConnectionManagercopy(String url, String name)
    
abstract public  voiddeleteConnection(PooledConnection connection)
     Delete a connection that is no more valid.
public  voiddeleteConnection(long transactionId)
     Delete a bad connection that was used for a transaction.
public  voiddeletePersistentConnection(long persistentConnectionId)
    
abstract protected  voiddoConnectionFinalization()
     Must be implemented by class extending AbstractConnectionManager to finalize their connections.
abstract protected  voiddoConnectionInitialization()
     Must be implemented by class extending AbstractConnectionManager to initalize their connections.
protected  voidfinalize()
     Ensures that the connections are closed when the object is garbage collected.
final public  voidfinalizeConnections()
     Releases all the connections to the database.
abstract public  voidflagAllConnectionsForRenewal()
     Force all connections to be renewed when they are used next.
abstract protected  PooledConnectiongetConnection()
     Gets a connection from the pool (implementation specific).
public  PooledConnectiongetConnectionForTransaction(long transactionId)
     Gets a new connection for a transaction.
public  ConnectiongetConnectionFromDriver()
     Get a connection from DriverManager.
abstract public  intgetCurrentNumberOfConnections()
     Get the current number of connections open for this connection manager.
public  StringgetDriverClassName()
     Returns the driverClassName value.
public  StringgetDriverPath()
     Returns the driverPath value.
public  StringgetLogin()
     Returns the login used by this connection manager.
public  StringgetPassword()
     Returns the password used by this connection manager.
public  StringgetVLogin()
    
public  StringgetXml()
    
abstract protected  StringgetXmlImpl()
    
final public  voidinitializeConnections()
     Initializes the connection(s) to the database.
public  booleanisInitialized()
     Tests if the connections have been initialized.
protected  voidnotifyPersistentConnectionPingerThread()
    
public  voidregisterConnectionForTransaction(PooledConnection c, long transactionId)
     Enlist a connection for a transaction (maintains the transaction id <-> connection mapping).
abstract protected  voidreleaseConnection(PooledConnection connection)
     Releases a connection.
public  voidreleaseConnectionForTransaction(long transactionId)
     Releases a connection used for a transaction.
public  voidreleaseConnectionInAutoCommit(AbstractRequest request, PooledConnection c)
     Releases a connection if it is not persistent.
abstract protected  voidreleasePersistentConnection(PooledConnection connection)
     Releases a persistent connection.
public  voidreleasePersistentConnectionInAutoCommit(long persistentConnectionId)
     Releases a connection used for a persistent connection.
public  PooledConnectionretrieveConnectionForTransaction(long transactionId)
     Retrieves a connection used for a transaction.
public  PooledConnectionretrieveConnectionInAutoCommit(AbstractRequest request)
     Gets a connection from the pool in autocommit mode.
public  voidsetConnectionTestStatement(String connectionTestStatement)
     Set the SQL string used to test whether or not the server is available.
public  voidsetVLogin(String login)
    
public synchronized  voidshutdown()
     Mark the ConnectionManager as shutdown.
protected  voidstopPersistentConnectionPingerThread()
    

Field Detail
backendName
protected String backendName(Code)
Name of the DatabaseBackend owning this connection manager.



backendUrl
protected String backendUrl(Code)
URL of the DatabaseBackend owning this connection manager.



connectionTestStatement
protected String connectionTestStatement(Code)



driverClassName
protected String driverClassName(Code)
The class name of the driver



driverPath
protected String driverPath(Code)
The path to the driver if null the default directory is used



idlePersistentConnectionPingInterval
protected int idlePersistentConnectionPingInterval(Code)
Time after which an idle persistent connection will be checked.



idlePersistentConnectionPingRunning
protected boolean idlePersistentConnectionPingRunning(Code)
Indicates if the idle persistent connections checker thread is running.



idlePersistentConnections
protected LinkedList idlePersistentConnections(Code)
Stack of idle persistent connections



initialized
protected boolean initialized(Code)
true if the connection pool has been initialized.



isShutdown
protected boolean isShutdown(Code)
true if the connection manager has been shutdown and should no longer hand out Connections.



logger
static Trace logger(Code)
Logger instance.



persistentConnectionPingerThread
protected IdlePersistentConnectionsPingerThread persistentConnectionPingerThread(Code)
Allow to check idle persistent connections against the backend.



persistentConnections
protected transient Hashtable persistentConnections(Code)
Hashtable<Long, PooledConnection> which associates a persistent connection id (encapsulated in a Long) with a PooledConnection.



persistentConnectionsIdleTime
protected LinkedList persistentConnectionsIdleTime(Code)
Stores the time on which persistent connections have been last used.



rLogin
protected String rLogin(Code)
Backend connection login to be used by this connection manager.



rPassword
protected String rPassword(Code)
Backend connection password to be used by this connection manager.




Constructor Detail
AbstractConnectionManager
protected AbstractConnectionManager(String backendUrl, String backendName, String rLogin, String rPassword, String driverPath, String driverClassName)(Code)
Creates a new AbstractConnectionManager instance: assigns login/password and instanciates transaction id/connection mapping.
Parameters:
  backendUrl - URL of the DatabaseBackend owning thisconnection manager
Parameters:
  backendName - name of the DatabaseBackend owning thisconnection manager
Parameters:
  rLogin - backend connection login to be used by this connectionmanager
Parameters:
  rPassword - backend connection password to be used by this connectionmanager
Parameters:
  driverPath - path for driver
Parameters:
  driverClassName - class name for driver




Method Detail
clone
abstract protected Object clone() throws CloneNotSupportedException(Code)

See Also:   java.lang.Object.clone



clone
abstract public AbstractConnectionManager clone(String rLogin, String rPassword)(Code)
Creates a new connection manager with the same parameters but a different backend user and password.
Parameters:
  rLogin - real login
Parameters:
  rPassword - real password an AbstractConnectionManager for the new user



closeConnection
protected void closeConnection(PooledConnection connection)(Code)
Close an unwanted connection. The connection may be in a bad state so we ignore all errors.
Parameters:
  connection - to be closed



copy
public AbstractConnectionManager copy(String url, String name) throws Exception(Code)
Copy this connection manager and replace the name of the backend and its url Every other parameter is the same
Parameters:
  url - the url to the backend associated to this ConnectionManager
Parameters:
  name - the name of the backend AbstractConnectionManager
throws:
  Exception - if clone fails



deleteConnection
abstract public void deleteConnection(PooledConnection connection)(Code)
Delete a connection that is no more valid.
Parameters:
  connection - the connection to delete.



deleteConnection
public void deleteConnection(long transactionId)(Code)
Delete a bad connection that was used for a transaction. The corresponding connection is deleted by calling AbstractConnectionManager.deleteConnection(PooledConnection) .
Parameters:
  transactionId - the transaction id.
See Also:   AbstractConnectionManager.releaseConnection(PooledConnection)



deletePersistentConnection
public void deletePersistentConnection(long persistentConnectionId)(Code)
Deletes a connection associated to the persistentConnectionId.
Do nothing if there is no connection associated to the persistentConnectionId
Parameters:
  persistentConnectionId - the id of the persistent connection to delete



doConnectionFinalization
abstract protected void doConnectionFinalization() throws SQLException(Code)
Must be implemented by class extending AbstractConnectionManager to finalize their connections.
throws:
  SQLException - if an error occurs



doConnectionInitialization
abstract protected void doConnectionInitialization() throws SQLException(Code)
Must be implemented by class extending AbstractConnectionManager to initalize their connections.
throws:
  SQLException - if an error occurs



finalize
protected void finalize() throws Throwable(Code)
Ensures that the connections are closed when the object is garbage collected.
exception:
  Throwable - if an error occurs.



finalizeConnections
final public void finalizeConnections() throws SQLException(Code)
Releases all the connections to the database.
exception:
  SQLException - if an error occurs.



flagAllConnectionsForRenewal
abstract public void flagAllConnectionsForRenewal()(Code)
Force all connections to be renewed when they are used next. This just sets a flag and connections will be lazily replaced as needed.



getConnection
abstract protected PooledConnection getConnection() throws UnreachableBackendException(Code)
Gets a connection from the pool (implementation specific). a Connection or null if no connectionis available or if the connection has not been initialized.
throws:
  UnreachableBackendException - if the backend must be disabled



getConnectionForTransaction
public PooledConnection getConnectionForTransaction(long transactionId) throws UnreachableBackendException(Code)
Gets a new connection for a transaction. This function calls AbstractConnectionManager.getConnection() to get the connection and store the mapping between the connection and the transaction id.

Note that this function does not start the transaction, it is up to the caller to call setAutoCommit(false) on the returned connection.
Parameters:
  transactionId - the transaction id. a Connection or null if no connectionis available .
throws:
  UnreachableBackendException - if the backend must be disabled
See Also:   AbstractConnectionManager.getConnection()




getConnectionFromDriver
public Connection getConnectionFromDriver()(Code)
Get a connection from DriverManager. a new connection or null if Driver.getConnection() failed.
See Also:   DriverManager.getConnection(StringStringStringStringString)



getCurrentNumberOfConnections
abstract public int getCurrentNumberOfConnections()(Code)
Get the current number of connections open for this connection manager. the current number of open connections



getDriverClassName
public String getDriverClassName()(Code)
Returns the driverClassName value. Returns the driverClassName.



getDriverPath
public String getDriverPath()(Code)
Returns the driverPath value. Returns the driverPath.



getLogin
public String getLogin()(Code)
Returns the login used by this connection manager. a String value.



getPassword
public String getPassword()(Code)
Returns the password used by this connection manager. a String value.



getVLogin
public String getVLogin()(Code)
Returns the vLogin.



getXml
public String getXml()(Code)

See Also:   org.continuent.sequoia.common.xml.XmlComponent.getXml



getXmlImpl
abstract protected String getXmlImpl()(Code)
Gets xml formatted information on this connection manager xml formatted string that conforms to sequoia.dtd



initializeConnections
final public void initializeConnections() throws SQLException(Code)
Initializes the connection(s) to the database. The caller must ensure that the driver has already been loaded else an exception will be thrown.
exception:
  SQLException - if an error occurs.



isInitialized
public boolean isInitialized()(Code)
Tests if the connections have been initialized. true if the connections have been initialized.



notifyPersistentConnectionPingerThread
protected void notifyPersistentConnectionPingerThread()(Code)



registerConnectionForTransaction
public void registerConnectionForTransaction(PooledConnection c, long transactionId)(Code)
Enlist a connection for a transaction (maintains the transaction id <-> connection mapping).
Parameters:
  c - a pooled connection
Parameters:
  transactionId - the transaction id to register this connection for



releaseConnection
abstract protected void releaseConnection(PooledConnection connection)(Code)
Releases a connection.
Parameters:
  connection - the connection to release.



releaseConnectionForTransaction
public void releaseConnectionForTransaction(long transactionId)(Code)
Releases a connection used for a transaction. The corresponding connection is released by calling AbstractConnectionManager.releaseConnection(PooledConnection) .
Parameters:
  transactionId - the transaction id.
See Also:   AbstractConnectionManager.releaseConnection(PooledConnection)



releaseConnectionInAutoCommit
public void releaseConnectionInAutoCommit(AbstractRequest request, PooledConnection c)(Code)
Releases a connection if it is not persistent. The corresponding connection is released by calling AbstractConnectionManager.releaseConnection(PooledConnection) .
Parameters:
  request - the request asking for a connection (we will check itspersistent connection id)
Parameters:
  c - the connection to release.
See Also:   AbstractConnectionManager.releaseConnection(PooledConnection)



releasePersistentConnection
abstract protected void releasePersistentConnection(PooledConnection connection)(Code)
Releases a persistent connection. This will close this connection immediatly.
Parameters:
  connection - the connection to release.



releasePersistentConnectionInAutoCommit
public void releasePersistentConnectionInAutoCommit(long persistentConnectionId)(Code)
Releases a connection used for a persistent connection. The corresponding connection is released by calling AbstractConnectionManager.releaseConnection(PooledConnection) .
Parameters:
  persistentConnectionId - the persistent connection id.
See Also:   AbstractConnectionManager.releaseConnection(PooledConnection)



retrieveConnectionForTransaction
public PooledConnection retrieveConnectionForTransaction(long transactionId)(Code)
Retrieves a connection used for a transaction. This connection must have been allocated by calling AbstractConnectionManager.getConnectionForTransaction(long) .
Parameters:
  transactionId - the transaction id. a Connection or null if no connectionhas been found for this transaction id.
See Also:   AbstractConnectionManager.getConnectionForTransaction(long)



retrieveConnectionInAutoCommit
public PooledConnection retrieveConnectionInAutoCommit(AbstractRequest request) throws UnreachableBackendException(Code)
Gets a connection from the pool in autocommit mode. If a persistent id is defined for the request, the appropriate connection is retrieved.
Parameters:
  request - the request asking for a connection (we will check itspersistent connection id) a PooledConnection or null if noconnection is available or if the connection has not beeninitialized.
throws:
  UnreachableBackendException - if the backend must be disabled



setConnectionTestStatement
public void setConnectionTestStatement(String connectionTestStatement)(Code)
Set the SQL string used to test whether or not the server is available.
Parameters:
  connectionTestStatement - connection test statement to use for thispool



setVLogin
public void setVLogin(String login)(Code)

Parameters:
  login - The vLogin to set.



shutdown
public synchronized void shutdown()(Code)
Mark the ConnectionManager as shutdown. getConnection() should return null from now on and any threads waiting in getConnection() should wake up. This is used when a database is shutting down due to an error. It is not needed in the case of a clean shutdown, because everybody will stop requesting connections at the correct time.



stopPersistentConnectionPingerThread
protected void stopPersistentConnectionPingerThread()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.