01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package javax.sql;
19:
20: import java.util.EventListener;
21:
22: /**
23: * An interface used to receive events generated by a
24: * <code>PooledConnection</code>.
25: * <p>
26: * This interface would typically be implemented by a component which implements
27: * Connection Pooling (a Connection Pool Manager). A Connection will signal
28: * events to a ConnectionEventListener either when the application closes a
29: * Connection it has been using or when a significant error occurs while the
30: * Connection is being used, where the Connection should not be used again.
31: * <p>
32: * The Connection Pool Manager can return closed Connections to the Pool for
33: * later reuse. Connections experiencing an error should be discarded.
34: *
35: */
36: public interface ConnectionEventListener extends EventListener {
37:
38: /**
39: * Notifies the ConnectionEventListener that an application has called the
40: * <code>close</code> method on a pooled Connection.
41: *
42: * @param theEvent
43: * a ConnectionEvent containing detail about the source of the
44: * event.
45: */
46: public void connectionClosed(ConnectionEvent theEvent);
47:
48: /**
49: * Notifies the ConnectionEventListener that an error has occurred while a
50: * PooledConnection was being used and that the PooledConnection can no
51: * longer be used for work. This notification is done just before the
52: * SQLException passed in the event message is thrown to the application.
53: *
54: * @param theEvent
55: * a ConnectionEvent containing detail about the source of the
56: * event and the SQLException that has occurred.
57: */
58: public void connectionErrorOccurred(ConnectionEvent theEvent);
59: }
|