Source Code Cross Referenced for ConnectionProvider.java in  » Database-JDBC-Connection-Pool » SmartPool » org » smartlib » pool » core » 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 » SmartPool » org.smartlib.pool.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * @(#) ConnectionProvider 1.0 02/08/01
03:         */
04:        package org.smartlib.pool.core;
05:
06:        import java.sql.*;
07:
08:        /**
09:         * This interface is used to wrap the SmartPool to an existing connection pool.
10:         *  
11:         * <p>To wrap the SmartPool to an existing pool, provide an instance of 
12:         * this interface in the configuration file. SmartPool will then draw 
13:         * connection from this pool rather then drawing raw connections to the 
14:         * pool. </p>
15:         *
16:         * <p>Also if the SmartPool is wrapped around another pool
17:         * it will draw a connection on every call by calling 
18:         * ConnectionProvider.getConnection().</p>
19:         *
20:         * <p>Similarly when you call Connection.close(), SmartPool returns the 
21:         * connection back to the original pool immediately by calling 
22:         * ConnectionProvider.returnConnection().</p> 
23:         *
24:         * <p>In short when this feature is used, SmartPool is just another layer of 
25:         * indirection. SmartPool does not maintain any pool. This has been 
26:         * specifically designed to do so. This is because the external pool to which
27:         * SmartPool is wrapped is expected to do all the pooling. SmartPool can be 
28:         * used to detect leaks and monitor live connections etc. <p>
29:         *
30:         */
31:
32:        /* Note from the Author: I realized this when I tested this feature against an
33:         * Application Server DataSource pool and to my surprise (I call my self
34:         * a J2EE expert :) ) I discovered that the application server requires the
35:         * connection to be returned to the pool.
36:         * The Application Server manages the state of the connections and thus it is 
37:         * imperative to return the connection back to the Application Server after 
38:         * each use. 
39:         */
40:
41:        public interface ConnectionProvider {
42:
43:            /**
44:             * <p>This method implementation should fetch the connection.
45:             * This method is expected to block if a connection is not available untill
46:             * a connection a available.</p>
47:             *
48:             * <p>Whatever preprocessing you want to do, do it here. SmartPool will not 
49:             * manuplate the connection state in anyway.</p>
50:             * e.g. of preprocessing:<br> 
51:             * <li>		1. Testing if the connection is valid.
52:             * <li>		2. con.setAutoCommit(false|true)
53:             * 
54:             * <p>If you throw any Exception while doing this, SmartPool will wrap this 
55:             * exception with ConnectionPoolException and throw it back to you in the 
56:             * SmartPoolFactory.getConnection() method. So better behave your self and 
57:             * handle all the cases here itself.</p>
58:             *
59:             *  
60:             */
61:            public Connection getConnection() throws Exception;
62:
63:            /**
64:             *<p>This method implementation should release the connection.</p>	 
65:             * 
66:             * <p>Whatever postprocessing you want to do, do it here.</p>
67:             * e.g. of postprocessing<br> 
68:             * <li>		1. if (!conn.getAutoCommit()) conn.commit();
69:             * 	
70:             * <p>If you throw any Exception while doing this, SmartPool will wrap this 
71:             * exception with SQLException and throw it back to you in the 
72:             * Connection.close() method. So better behave your self and 
73:             * handle all the cases here itself.</p>
74:             * 	
75:             */
76:            public void returnConnection(Connection conn) throws Exception;
77:
78:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.