KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > proxool > ConnectionListenerIF


1 /*
2  * This software is released under a licence similar to the Apache Software Licence.
3  * See org.logicalcobwebs.proxool.package.html for details.
4  * The latest version is available at http://proxool.sourceforge.net
5  */

6 package org.logicalcobwebs.proxool;
7
8 import java.sql.Connection JavaDoc;
9 import java.sql.SQLException JavaDoc;
10
11 /**
12  * You can listen to the lifecycle of a connection. Sometimes, you may
13  * want to perform a task when the connection is born or dies. Actually,
14  * the reason why we originally did this is now obsolete. But the code
15  * remains here just in case. You need to
16  * {@link ProxoolFacade#setConnectionListener register}
17  * your implementation with ProxoolFacade.
18  *
19  * <pre>
20  * String alias = "myPool";
21  * ConnectionListenerIF myConnectionListener = new MyConnectionListener();
22  * ProxoolFacade.{@link org.logicalcobwebs.proxool.ProxoolFacade#addConnectionListener addConnectionListener}(alias, myConnectionListener);
23  * </pre>
24  *
25  * @version $Revision: 1.7 $, $Date: 2003/03/03 11:11:57 $
26  * @author billhorsman
27  * @author $Author: billhorsman $ (current maintainer)
28  */

29 public interface ConnectionListenerIF {
30
31     /**
32      * Happens everytime we create a new connection. You can use this
33      * to allocate resources to a connection that might be useful during
34      * the lifetime of the connection.
35      *
36      * @param connection the connection that has just been created
37      * @throws SQLException if anything goes wrong (which will then be logged but ignored)
38      */

39     void onBirth(Connection JavaDoc connection) throws SQLException JavaDoc;
40
41     /**
42      * Happens just before we expire a connection. You can use this to
43      * reclaim resources from a connection.
44      *
45      * @param connection the connection that is about to expire
46      * @throws SQLException if anything goes wrong (which will then be logged but ignored)
47      */

48     void onDeath(Connection JavaDoc connection) throws SQLException JavaDoc;
49
50     /**
51      * Happens after every successful execute. Note that the command
52      * is not fully implemented at this stage. At some point it might represent
53      * the SQL that is sent to the database (or the procedure call that was used).
54      *
55      * @param command what command was being executed
56      * @param elapsedTime how long the call took (in milliseconds)
57      */

58     void onExecute(String JavaDoc command, long elapsedTime);
59
60     /**
61      * Happens everytime an exception was thrown during an execute method
62      * Note that the command
63      * is not fully implemented at this stage. At some point it might represent
64      * the SQL that is sent to the database (or the procedure call that was used).
65      *
66      * @param command what command was being executed
67      * @param exception what exception was thrown
68      */

69     void onFail(String JavaDoc command, Exception JavaDoc exception);
70
71 }
72
73 /*
74  Revision history:
75  $Log: ConnectionListenerIF.java,v $
76  Revision 1.7 2003/03/03 11:11:57 billhorsman
77  fixed licence
78
79  Revision 1.6 2003/02/08 00:35:30 billhorsman
80  doc
81
82  Revision 1.5 2002/12/15 19:21:42 chr32
83  Changed @linkplain to @link (to preserve JavaDoc for 1.2/1.3 users).
84
85  Revision 1.4 2002/10/25 16:00:20 billhorsman
86  added better class javadoc
87
88  Revision 1.3 2002/10/23 21:04:36 billhorsman
89  checkstyle fixes (reduced max line width and lenient naming convention
90
91  Revision 1.2 2002/10/16 11:45:52 billhorsman
92  removed obsolete cleanupClob method and added more javadoc
93
94  Revision 1.1.1.1 2002/09/13 08:12:34 billhorsman
95  new
96
97  Revision 1.5 2002/08/24 19:43:04 billhorsman
98  new execute events
99
100  Revision 1.4 2002/06/28 11:15:41 billhorsman
101  didn't really need ListenerIF
102
103 */

104
Popular Tags