Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/sql/ConnectionEvent.java
38829 views
/*1* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.sql;2627import java.sql.SQLException;2829/**30* <P>An <code>Event</code> object that provides information about the31* source of a connection-related event. <code>ConnectionEvent</code>32* objects are generated when an application closes a pooled connection33* and when an error occurs. The <code>ConnectionEvent</code> object34* contains two kinds of information:35* <UL>36* <LI>The pooled connection closed by the application37* <LI>In the case of an error event, the <code>SQLException</code>38* about to be thrown to the application39* </UL>40*41* @since 1.442*/4344public class ConnectionEvent extends java.util.EventObject {4546/**47* <P>Constructs a <code>ConnectionEvent</code> object initialized with48* the given <code>PooledConnection</code> object. <code>SQLException</code>49* defaults to <code>null</code>.50*51* @param con the pooled connection that is the source of the event52* @throws IllegalArgumentException if <code>con</code> is null.53*/54public ConnectionEvent(PooledConnection con) {55super(con);56}5758/**59* <P>Constructs a <code>ConnectionEvent</code> object initialized with60* the given <code>PooledConnection</code> object and61* <code>SQLException</code> object.62*63* @param con the pooled connection that is the source of the event64* @param ex the SQLException about to be thrown to the application65* @throws IllegalArgumentException if <code>con</code> is null.66*/67public ConnectionEvent(PooledConnection con, SQLException ex) {68super(con);69this.ex = ex;70}7172/**73* <P>Retrieves the <code>SQLException</code> for this74* <code>ConnectionEvent</code> object. May be <code>null</code>.75*76* @return the SQLException about to be thrown or <code>null</code>77*/78public SQLException getSQLException() { return ex; }7980/**81* The <code>SQLException</code> that the driver will throw to the82* application when an error occurs and the pooled connection is no83* longer usable.84* @serial85*/86private SQLException ex = null;8788/**89* Private serial version unique ID to ensure serialization90* compatibility.91*/92static final long serialVersionUID = -4843217645290030002L;9394}959697