Java Doc for ConnectionManager.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » component » jdbcpool » 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 » J2EE » ow2 easybeans » org.ow2.easybeans.component.jdbcpool 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.ow2.easybeans.component.jdbcpool.ConnectionManager

ConnectionManager
public class ConnectionManager implements DataSource,XADataSource,Referenceable,ConnectionEventListener(Code)
DataSource implementation. Manage a pool of connections.
author:
   Philippe Durieux
author:
   Florent Benoit



Constructor Summary
public  ConnectionManager()
     Constructor for Factory.

Method Summary
public synchronized  voidadjust()
     Adjust the pool size, according to poolMax and poolMin values.
public  StringcheckConnection(String testStatement)
     Check on a connection the test statement.
public synchronized  voidcloseAllConnection()
     Close all connections in the pool, when server is shut down.
public  voidconnectionClosed(ConnectionEvent event)
     Notifies this ConnectionEventListener that the application has called the method close on its representation of a pooled connection.
public  voidconnectionErrorOccurred(ConnectionEvent event)
     Notifies this ConnectionEventListener that a fatal error has occurred and the pooled connection can no longer be used.
public synchronized  voidfreeConnections(Transaction tx)
     The transaction has committed (or rolled back).
public  intgetBusyMaxRecent()
    
public  intgetBusyMinRecent()
    
public  intgetCheckLevel()
    
public  StringgetClassName()
    
public  ConnectiongetConnection()
    
public  ConnectiongetConnection(String username, String password)
     Attempts to establish a connection with the data source that this DataSource object represents.
public  intgetConnectionFailures()
    
public  intgetConnectionLeaks()
    
public static  ConnectionManagergetConnectionManager(String dsname)
     Gets the ConnectionManager matching the DataSource name.
Parameters:
  dsname - datasource name.
public  intgetCurrentBusy()
    
public  intgetCurrentInTx()
    
public  intgetCurrentOpened()
    
public  intgetCurrentWaiters()
    
public  StringgetDSName()
    
public  StringgetDatasourceName()
     Gets the name of the datasource.
public  PrintWritergetLogWriter()
    
public  intgetLoginTimeout()
    
public  intgetMaxAge()
    
public  longgetMaxAgeMilli()
    
public  intgetMaxOpenTime()
    
public  longgetMaxOpenTimeMilli()
    
public  intgetMaxWaitTime()
    
public  intgetMaxWaiters()
    
public  intgetOpenedCount()
    
public  StringgetPassword()
    
public  intgetPoolMax()
    
public  intgetPoolMin()
    
public  intgetPstmtMax()
    
public  ReferencegetReference()
     Retrieves the Reference of this object.
public  intgetRejectedFull()
    
public  intgetRejectedOpen()
    
public  intgetRejectedOther()
    
public  intgetRejectedTimeout()
    
public  intgetSamplingPeriod()
    
public  intgetServedOpen()
    
public  StringgetTestStatement()
    
public  StringgetTransactionIsolation()
     Gets the transaction isolation level.
public  StringgetUrl()
    
public  StringgetUserName()
    
public  intgetWaiterCount()
    
public  intgetWaitersHigh()
    
public  intgetWaitersHighRecent()
    
public  longgetWaitingHigh()
    
public  longgetWaitingHighRecent()
    
public  longgetWaitingTime()
    
public  XAConnectiongetXAConnection()
     Attempts to establish a physical database connection that can be used in a distributed transaction.
public  XAConnectiongetXAConnection(String user, String passwd)
     Attempts to establish a physical database connection, using the given user name and password.
public synchronized  JManagedConnectionopenConnection(String user, Transaction tx)
     Lookup connection in the pool for this user/tx.
public  voidpoolConfigure(String connchecklevel, String connmaxage, String maxopentime, String connteststmt, String pstmtmax, String minconpool, String maxconpool, String maxwaittime, String maxwaiters, String samplingperiod)
     Configure the Connection pool.
public  voidrecomputeBusy()
     compute current min/max busyConnections.
public synchronized  voidsampling()
     make samples with some monitoring values.
public  voidsetCheckLevel(int level)
    
public  voidsetClassName(String className)
     Sets the driver class for JDBC.
public  voidsetDSName(String s)
    
public  voidsetDatasourceName(String dataSourceName)
     Sets the name of the datasource.
public  voidsetLogWriter(PrintWriter out)
    
public  voidsetLoginTimeout(int seconds)
    
public  voidsetMaxAge(int mn)
    
public  voidsetMaxOpenTime(int mn)
    
public  voidsetMaxWaitTime(int sec)
    
public  voidsetMaxWaiters(int nb)
    
public  voidsetPassword(String password)
     Sets the password used to get connections.
public synchronized  voidsetPoolMax(int max)
    
Parameters:
  max - max pool size.
public synchronized  voidsetPoolMin(int min)
    
public  voidsetPstmtMax(int nb)
    
public  voidsetSamplingPeriod(int sec)
    
public  voidsetTestStatement(String s)
    
protected  voidsetTm(TransactionManager tm)
     Sets the transaction managed used by the connections.
public  voidsetTransactionIsolation(String level)
     Sets the transaction isolation level of the connections.
public  voidsetUrl(String url)
     Sets the url to get connections.
public  voidsetUserName(String userName)
     Sets the user for getting connections.


Constructor Detail
ConnectionManager
public ConnectionManager()(Code)
Constructor for Factory.




Method Detail
adjust
public synchronized void adjust()(Code)
Adjust the pool size, according to poolMax and poolMin values. Also remove old connections in the freeList.



checkConnection
public String checkConnection(String testStatement) throws SQLException(Code)
Check on a connection the test statement.
Parameters:
  testStatement - the statement to use for test the test statement if the test succeeded, an error messageotherwise
throws:
  SQLException - If an error occured when trying to test (not due tothe test itself, but to other preliminary or post operation).



closeAllConnection
public synchronized void closeAllConnection()(Code)
Close all connections in the pool, when server is shut down.



connectionClosed
public void connectionClosed(ConnectionEvent event)(Code)
Notifies this ConnectionEventListener that the application has called the method close on its representation of a pooled connection.
Parameters:
  event - an event object describing the source ofthe event



connectionErrorOccurred
public void connectionErrorOccurred(ConnectionEvent event)(Code)
Notifies this ConnectionEventListener that a fatal error has occurred and the pooled connection can no longer be used. The driver makes this notification just before it throws the application the SQLException contained in the given ConnectionEvent object.
Parameters:
  event - an event object describing the source ofthe event and containing the SQLException that thedriver is about to throw



freeConnections
public synchronized void freeConnections(Transaction tx)(Code)
The transaction has committed (or rolled back). We can return its connections to the pool of available connections.
Parameters:
  tx - the non null transaction



getBusyMaxRecent
public int getBusyMaxRecent()(Code)
maximum nb of busy connections in last sampling period.



getBusyMinRecent
public int getBusyMinRecent()(Code)
minimum nb of busy connections in last sampling period.



getCheckLevel
public int getCheckLevel()(Code)
connection checking level



getClassName
public String getClassName()(Code)
the JDBC driver class name.



getConnection
public Connection getConnection() throws SQLException(Code)



getConnection
public Connection getConnection(String username, String password) throws SQLException(Code)
Attempts to establish a connection with the data source that this DataSource object represents. - comes from the javax.sql.DataSource interface
Parameters:
  username - - the database user on whose behalf the connection isbeing made
Parameters:
  password - - the user's password a connection to the data source
throws:
  SQLException - - if a database access error occurs



getConnectionFailures
public int getConnectionFailures()(Code)
int number of xa connection failures on open.



getConnectionLeaks
public int getConnectionLeaks()(Code)
int number of connection leaks.



getConnectionManager
public static ConnectionManager getConnectionManager(String dsname)(Code)
Gets the ConnectionManager matching the DataSource name.
Parameters:
  dsname - datasource name. a connection manager impl.



getCurrentBusy
public int getCurrentBusy()(Code)
int number of busy xa connection.



getCurrentInTx
public int getCurrentInTx()(Code)
int number of xa connection reserved for tx.



getCurrentOpened
public int getCurrentOpened()(Code)
int number of xa connection



getCurrentWaiters
public int getCurrentWaiters()(Code)
current number of connection waiters.



getDSName
public String getDSName()(Code)
Jndi name of the datasource



getDatasourceName
public String getDatasourceName()(Code)
Gets the name of the datasource. the name of the datasource



getLogWriter
public PrintWriter getLogWriter() throws SQLException(Code)



getLoginTimeout
public int getLoginTimeout() throws SQLException(Code)



getMaxAge
public int getMaxAge()(Code)
max age for connections (in mm).



getMaxAgeMilli
public long getMaxAgeMilli()(Code)
max age for connections (in millisec).



getMaxOpenTime
public int getMaxOpenTime()(Code)
max age for connections (in mns).



getMaxOpenTimeMilli
public long getMaxOpenTimeMilli()(Code)
max age for connections (in millisecs).



getMaxWaitTime
public int getMaxWaitTime()(Code)
waiter timeout in seconds.



getMaxWaiters
public int getMaxWaiters()(Code)
max nb of waiters



getOpenedCount
public int getOpenedCount()(Code)
int number of physical jdbc connection opened.



getPassword
public String getPassword()(Code)
the password used for connections.



getPoolMax
public int getPoolMax()(Code)
actual max pool size



getPoolMin
public int getPoolMin()(Code)
min pool size.



getPstmtMax
public int getPstmtMax()(Code)
PreparedStatement cache size.



getReference
public Reference getReference() throws NamingException(Code)
Retrieves the Reference of this object. Used at binding time by JNDI to build a reference on this object. The non-null Reference of this object.
exception:
  NamingException - If a naming exception was encountered whileretrieving the reference.



getRejectedFull
public int getRejectedFull()(Code)
int number of open calls that were rejected due to waiteroverflow.



getRejectedOpen
public int getRejectedOpen()(Code)
int number of open calls that were rejected.



getRejectedOther
public int getRejectedOther()(Code)
int number of open calls that were rejected.



getRejectedTimeout
public int getRejectedTimeout()(Code)
int number of open calls that were rejected by timeout.



getSamplingPeriod
public int getSamplingPeriod()(Code)
sampling period in sec.



getServedOpen
public int getServedOpen()(Code)
int number of xa connection served.



getTestStatement
public String getTestStatement()(Code)
test statement used when checkLevel = 2.



getTransactionIsolation
public String getTransactionIsolation()(Code)
Gets the transaction isolation level. transaction isolation level.



getUrl
public String getUrl()(Code)
the url used to get the connection.



getUserName
public String getUserName()(Code)
the user used for getting connections.



getWaiterCount
public int getWaiterCount()(Code)
total nb of waiters since the datasource creation.



getWaitersHigh
public int getWaitersHigh()(Code)
maximum nb of waiters since the datasource creation.



getWaitersHighRecent
public int getWaitersHighRecent()(Code)
maximum nb of waiters in last sampling period.



getWaitingHigh
public long getWaitingHigh()(Code)
max waiting time since the datasource creation.



getWaitingHighRecent
public long getWaitingHighRecent()(Code)
max waiting time in last sampling period.



getWaitingTime
public long getWaitingTime()(Code)
total waiting time since the datasource creation.



getXAConnection
public XAConnection getXAConnection() throws SQLException(Code)
Attempts to establish a physical database connection that can be used in a distributed transaction. an XAConnection object, which represents aphysical connection to a data source, that can be used ina distributed transaction
exception:
  SQLException - if a database access error occurs



getXAConnection
public XAConnection getXAConnection(String user, String passwd) throws SQLException(Code)
Attempts to establish a physical database connection, using the given user name and password. The connection that is returned is one that can be used in a distributed transaction - comes from the javax.sql.XADataSource interface
Parameters:
  user - - the database user on whose behalf the connection is beingmade
Parameters:
  passwd - - the user's password an XAConnection object, which represents a physical connection toa data source, that can be used in a distributed transaction
throws:
  SQLException - - if a database access error occurs



openConnection
public synchronized JManagedConnection openConnection(String user, Transaction tx) throws SQLException(Code)
Lookup connection in the pool for this user/tx.
Parameters:
  user - user name
Parameters:
  tx - Transaction the connection is involved a free JManagedConnection (never null)
throws:
  SQLException - Cannot open a connection because the pool's max sizeis reached



poolConfigure
public void poolConfigure(String connchecklevel, String connmaxage, String maxopentime, String connteststmt, String pstmtmax, String minconpool, String maxconpool, String maxwaittime, String maxwaiters, String samplingperiod)(Code)
Configure the Connection pool. Called by the Container at init. Configuration can be set in datasource.properties files.
Parameters:
  connchecklevel - JDBC connection checking level
Parameters:
  connmaxage - JDBC connection maximum age
Parameters:
  maxopentime - JDBC connection maximum open time
Parameters:
  connteststmt - SQL query for test statement
Parameters:
  pstmtmax - prepare statement pool size per managed connection
Parameters:
  minconpool - Min size for the connection pool
Parameters:
  maxconpool - Max size for the connection pool
Parameters:
  maxwaittime - Max time to wait for a connection (in seconds)
Parameters:
  maxwaiters - Max nb of waiters for a connection
Parameters:
  samplingperiod - sampling period in sec.



recomputeBusy
public void recomputeBusy()(Code)
compute current min/max busyConnections.



sampling
public synchronized void sampling()(Code)
make samples with some monitoring values.



setCheckLevel
public void setCheckLevel(int level)(Code)

Parameters:
  level - jdbc connection checking level (0, 1, or 2)



setClassName
public void setClassName(String className) throws ClassNotFoundException(Code)
Sets the driver class for JDBC.
Parameters:
  className - the name of the JDBC driver
throws:
  ClassNotFoundException - if driver is not found



setDSName
public void setDSName(String s)(Code)

Parameters:
  s - Jndi name for the datasource



setDatasourceName
public void setDatasourceName(String dataSourceName)(Code)
Sets the name of the datasource.
Parameters:
  dataSourceName - the name of the datasource



setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException(Code)



setLoginTimeout
public void setLoginTimeout(int seconds) throws SQLException(Code)



setMaxAge
public void setMaxAge(int mn)(Code)

Parameters:
  mn - max age of connection in minutes.



setMaxOpenTime
public void setMaxOpenTime(int mn)(Code)

Parameters:
  mn - max time of open connection in minutes.



setMaxWaitTime
public void setMaxWaitTime(int sec)(Code)

Parameters:
  sec - max time to wait for a connection, in seconds.



setMaxWaiters
public void setMaxWaiters(int nb)(Code)

Parameters:
  nb - max nb of waiters



setPassword
public void setPassword(String password)(Code)
Sets the password used to get connections.
Parameters:
  password - the password value.



setPoolMax
public synchronized void setPoolMax(int max)(Code)

Parameters:
  max - max pool size. -1 means "no limit".



setPoolMin
public synchronized void setPoolMin(int min)(Code)

Parameters:
  min - minimum connection pool size to be set.



setPstmtMax
public void setPstmtMax(int nb)(Code)

Parameters:
  nb - PreparedStatement cache size.



setSamplingPeriod
public void setSamplingPeriod(int sec)(Code)

Parameters:
  sec - sampling period in sec.



setTestStatement
public void setTestStatement(String s)(Code)

Parameters:
  s - test statement



setTm
protected void setTm(TransactionManager tm)(Code)
Sets the transaction managed used by the connections.
Parameters:
  tm - the transaction manager.



setTransactionIsolation
public void setTransactionIsolation(String level)(Code)
Sets the transaction isolation level of the connections.
Parameters:
  level - the level of isolation.



setUrl
public void setUrl(String url)(Code)
Sets the url to get connections.
Parameters:
  url - the url for JDBC connections.



setUserName
public void setUserName(String userName)(Code)
Sets the user for getting connections.
Parameters:
  userName - the name of the user.



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.