Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/sql/StatementEvent.java
38829 views
/*1* Copyright (c) 2005, 2013, 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*/2425/*26* Created on Apr 28, 200527*/28package javax.sql;2930import java.sql.PreparedStatement;31import java.sql.SQLException;32import java.util.EventObject;3334/**35* A <code>StatementEvent</code> is sent to all <code>StatementEventListener</code>s which were36* registered with a <code>PooledConnection</code>. This occurs when the driver determines that a37* <code>PreparedStatement</code> that is associated with the <code>PooledConnection</code> has been closed or the driver determines38* is invalid.39* <p>40* @since 1.641*/42public class StatementEvent extends EventObject {4344static final long serialVersionUID = -8089573731826608315L;45private SQLException exception;46private PreparedStatement statement;4748/**49* Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code> and50* <code>PreparedStatement</code>. The <code>SQLException</code> contained in the event defaults to51* null.52* <p>53* @param con The <code>PooledConnection</code> that the closed or invalid54* <code>PreparedStatement</code>is associated with.55* @param statement The <code>PreparedStatement</code> that is being closed or is invalid56* <p>57* @throws IllegalArgumentException if <code>con</code> is null.58*59* @since 1.660*/61public StatementEvent(PooledConnection con,62PreparedStatement statement) {6364super(con);6566this.statement = statement;67this.exception = null;68}6970/**71* Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code>,72* <code>PreparedStatement</code> and <code>SQLException</code>73* <p>74* @param con The <code>PooledConnection</code> that the closed or invalid <code>PreparedStatement</code>75* is associated with.76* @param statement The <code>PreparedStatement</code> that is being closed or is invalid77* @param exception The <code>SQLException </code>the driver is about to throw to78* the application79*80* @throws IllegalArgumentException if <code>con</code> is null.81* <p>82* @since 1.683*/84public StatementEvent(PooledConnection con,85PreparedStatement statement,86SQLException exception) {8788super(con);8990this.statement = statement;91this.exception = exception;92}9394/**95* Returns the <code>PreparedStatement</code> that is being closed or is invalid96* <p>97* @return The <code>PreparedStatement</code> that is being closed or is invalid98* <p>99* @since 1.6100*/101public PreparedStatement getStatement() {102103return this.statement;104}105106/**107* Returns the <code>SQLException</code> the driver is about to throw108* <p>109* @return The <code>SQLException</code> the driver is about to throw110* <p>111* @since 1.6112*/113public SQLException getSQLException() {114115return this.exception;116}117}118119120