Showing the changes to java/pkg/javax/sql/ConnectionEvent.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,95 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package javax.sql; | ||
| 27 | |||
| 28 | import java.sql.SQLException; | ||
| 29 | |||
| 30 | /** | ||
| 31 | * <P>An <code>Event</code> object that provides information about the | ||
| 32 | * source of a connection-related event. <code>ConnectionEvent</code> | ||
| 33 | * objects are generated when an application closes a pooled connection | ||
| 34 | * and when an error occurs. The <code>ConnectionEvent</code> object | ||
| 35 | * contains two kinds of information: | ||
| 36 | * <UL> | ||
| 37 | * <LI>The pooled connection closed by the application | ||
| 38 | * <LI>In the case of an error event, the <code>SQLException</code> | ||
| 39 | * about to be thrown to the application | ||
| 40 | * </UL> | ||
| 41 | * | ||
| 42 | * @since 1.4 | ||
| 43 | */ | ||
| 44 | |||
| 45 | public class ConnectionEvent extends java.util.EventObject { | ||
| 46 | |||
| 47 | /** | ||
| 48 | * <P>Constructs a <code>ConnectionEvent</code> object initialized with | ||
| 49 | * the given <code>PooledConnection</code> object. <code>SQLException</code> | ||
| 50 | * defaults to <code>null</code>. | ||
| 51 | * | ||
| 52 | * @param con the pooled connection that is the source of the event | ||
| 53 | * @throws IllegalArgumentException if <code>con</code> is null. | ||
| 54 | */ | ||
| 55 | public ConnectionEvent(PooledConnection con) { | ||
| 56 | super(con); | ||
| 57 | } | ||
| 58 | |||
| 59 | /** | ||
| 60 | * <P>Constructs a <code>ConnectionEvent</code> object initialized with | ||
| 61 | * the given <code>PooledConnection</code> object and | ||
| 62 | * <code>SQLException</code> object. | ||
| 63 | * | ||
| 64 | * @param con the pooled connection that is the source of the event | ||
| 65 | * @param ex the SQLException about to be thrown to the application | ||
| 66 | * @throws IllegalArgumentException if <code>con</code> is null. | ||
| 67 | */ | ||
| 68 | public ConnectionEvent(PooledConnection con, SQLException ex) { | ||
| 69 | super(con); | ||
| 70 | this.ex = ex; | ||
| 71 | } | ||
| 72 | |||
| 73 | /** | ||
| 74 | * <P>Retrieves the <code>SQLException</code> for this | ||
| 75 | * <code>ConnectionEvent</code> object. May be <code>null</code>. | ||
| 76 | * | ||
| 77 | * @return the SQLException about to be thrown or <code>null</code> | ||
| 78 | */ | ||
| 79 | public SQLException getSQLException() { return ex; } | ||
| 80 | |||
| 81 | /** | ||
| 82 | * The <code>SQLException</code> that the driver will throw to the | ||
| 83 | * application when an error occurs and the pooled connection is no | ||
| 84 | * longer usable. | ||
| 85 | * @serial | ||
| 86 | */ | ||
| 87 | private SQLException ex = null; | ||
| 88 | |||
| 89 | /** | ||
| 90 | * Private serial version unique ID to ensure serialization | ||
| 91 | * compatibility. | ||
| 92 | */ | ||
| 93 | static final long serialVersionUID = -4843217645290030002L; | ||
| 94 | |||
| 95 | } | ||