01 /*
02 * Copyright 2000-2001 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package javax.sql;
27
28 /**
29 * <P>
30 * An object that registers to be notified of events generated by a
31 * <code>PooledConnection</code> object.
32 * <P>
33 * The <code>ConnectionEventListener</code> interface is implemented by a
34 * connection pooling component. A connection pooling component will
35 * usually be provided by a JDBC driver vendor or another system software
36 * vendor. A JDBC driver notifies a <code>ConnectionEventListener</code>
37 * object when an application is finished using a pooled connection with
38 * which the listener has registered. The notification
39 * occurs after the application calls the method <code>close</code> on
40 * its representation of a <code>PooledConnection</code> object. A
41 * <code>ConnectionEventListener</code> is also notified when a
42 * connection error occurs due to the fact that the <code>PooledConnection</code>
43 * is unfit for future use---the server has crashed, for example.
44 * The listener is notified by the JDBC driver just before the driver throws an
45 * <code>SQLException</code> to the application using the
46 * <code>PooledConnection</code> object.
47 *
48 * @since 1.4
49 */
50
51 public interface ConnectionEventListener extends
52 java.util.EventListener {
53
54 /**
55 * Notifies this <code>ConnectionEventListener</code> that
56 * the application has called the method <code>close</code> on its
57 * representation of a pooled connection.
58 *
59 * @param event an event object describing the source of
60 * the event
61 */
62 void connectionClosed(ConnectionEvent event);
63
64 /**
65 * Notifies this <code>ConnectionEventListener</code> that
66 * a fatal error has occurred and the pooled connection can
67 * no longer be used. The driver makes this notification just
68 * before it throws the application the <code>SQLException</code>
69 * contained in the given <code>ConnectionEvent</code> object.
70 *
71 * @param event an event object describing the source of
72 * the event and containing the <code>SQLException</code> that the
73 * driver is about to throw
74 */
75 void connectionErrorOccurred(ConnectionEvent event);
76
77 }
|