KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > sql > ConnectionEventListener


1 /*
2  * @(#)ConnectionEventListener.java 1.9 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.sql;
9
10 /**
11  * <P>
12  * An object that registers to be notified of events generated by a
13  * <code>PooledConnection</code> object.
14  * <P>
15  * The <code>ConnectionEventListener</code> interface is implemented by a
16  * connection pooling component. A connection pooling component will
17  * usually be provided by a JDBC driver vendor or another system software
18  * vendor. A JDBC driver notifies a <code>ConnectionEventListener</code>
19  * object when an application is finished using a pooled connection with
20  * which the listener has registered. The notification
21  * occurs after the application calls the method <code>close</code> on
22  * its representation of a <code>PooledConnection</code> object. A
23  * <code>ConnectionEventListener</code> is also notified when a
24  * connection error occurs due to the fact that the <code>PooledConnection</code>
25  * is unfit for future use---the server has crashed, for example.
26  * The listener is notified by the JDBC driver just before the driver throws an
27  * <code>SQLException</code> to the application using the
28  * <code>PooledConnection</code> object.
29  *
30  * @since 1.4
31  */

32
33 public interface ConnectionEventListener extends java.util.EventListener JavaDoc {
34
35   /**
36    * Notifies this <code>ConnectionEventListener</code> that
37    * the application has called the method <code>close</code> on its
38    * representation of a pooled connection.
39    *
40    * @param event an event object describing the source of
41    * the event
42    */

43   void connectionClosed(ConnectionEvent JavaDoc event);
44       
45   /**
46    * Notifies this <code>ConnectionEventListener</code> that
47    * a fatal error has occurred and the pooled connection can
48    * no longer be used. The driver makes this notification just
49    * before it throws the application the <code>SQLException</code>
50    * contained in the given <code>ConnectionEvent</code> object.
51    *
52    * @param event an event object describing the source of
53    * the event and containing the <code>SQLException</code> that the
54    * driver is about to throw
55    */

56   void connectionErrorOccurred(ConnectionEvent JavaDoc event);
57
58  }
59
60
61
62
63
64
Popular Tags