Path: blob/master/src/java.sql/share/classes/java/sql/SQLRecoverableException.java
41153 views
/*1* Copyright (c) 2006, 2020, 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 java.sql;2627/**28* The subclass of {@link SQLException} thrown in situations where a29* previously failed operation might be able to succeed if the application performs30* some recovery steps and retries the entire transaction or in the case of a31* distributed transaction, the transaction branch. At a minimum,32* the recovery operation must include closing the current connection and getting33* a new connection.34*35* @since 1.636*/37public class SQLRecoverableException extends java.sql.SQLException {3839/**40* Constructs a {@code SQLRecoverableException} object.41* The {@code reason}, {@code SQLState} are initialized42* to {@code null} and the vendor code is initialized to 0.43*44* The {@code cause} is not initialized, and may subsequently be45* initialized by a call to the46* {@link Throwable#initCause(java.lang.Throwable)} method.47*48* @since 1.649*/50public SQLRecoverableException() {51super();52}5354/**55* Constructs a {@code SQLRecoverableException} object56* with a given {@code reason}. The {@code SQLState}57* is initialized to {@code null} and the vendor code is initialized58* to 0.59*60* The {@code cause} is not initialized, and may subsequently be61* initialized by a call to the62* {@link Throwable#initCause(java.lang.Throwable)} method.63*64* @param reason a description of the exception65* @since 1.666*/67public SQLRecoverableException(String reason) {68super(reason);69}7071/**72* Constructs a {@code SQLRecoverableException} object73* with a given {@code reason} and {@code SQLState}.74*75* The {@code cause} is not initialized, and may subsequently be76* initialized by a call to the77* {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code78* is initialized to 0.79*80* @param reason a description of the exception81* @param SQLState an XOPEN or SQL:2003 code identifying the exception82* @since 1.683*/84public SQLRecoverableException(String reason, String SQLState) {85super(reason, SQLState);86}8788/**89* Constructs a {@code SQLRecoverableException} object90* with a given {@code reason}, {@code SQLState} and91* {@code vendorCode}.92*93* The {@code cause} is not initialized, and may subsequently be94* initialized by a call to the95* {@link Throwable#initCause(java.lang.Throwable)} method.96*97* @param reason a description of the exception98* @param SQLState an XOPEN or SQL:2003 code identifying the exception99* @param vendorCode a database vendor specific exception code100* @since 1.6101*/102public SQLRecoverableException(String reason, String SQLState, int vendorCode) {103super(reason, SQLState, vendorCode);104}105106/**107* Constructs a {@code SQLRecoverableException} object108* with a given {@code cause}.109* The {@code SQLState} is initialized110* to {@code null} and the vendor code is initialized to 0.111* The {@code reason} is initialized to {@code null} if112* {@code cause==null} or to {@code cause.toString()} if113* {@code cause!=null}.114*115* @param cause the underlying reason for this {@code SQLException} (which is saved for later retrieval by the {@code getCause()} method); may be null indicating116* the cause is non-existent or unknown.117* @since 1.6118*/119public SQLRecoverableException(Throwable cause) {120super(cause);121}122123/**124* Constructs a {@code SQLRecoverableException} object125* with a given126* {@code reason} and {@code cause}.127* The {@code SQLState} is initialized to {@code null}128* and the vendor code is initialized to 0.129*130* @param reason a description of the exception.131* @param cause the underlying reason for this {@code SQLException} (which is saved for later retrieval by the {@code getCause()} method); may be null indicating132* the cause is non-existent or unknown.133* @since 1.6134*/135public SQLRecoverableException(String reason, Throwable cause) {136super(reason, cause);137}138139/**140* Constructs a {@code SQLRecoverableException} object141* with a given142* {@code reason}, {@code SQLState} and {@code cause}.143* The vendor code is initialized to 0.144*145* @param reason a description of the exception.146* @param SQLState an XOPEN or SQL:2003 code identifying the exception147* @param cause the underlying reason for this {@code SQLException} (which is saved for later retrieval by the {@code getCause()} method); may be null indicating148* the cause is non-existent or unknown.149* @since 1.6150*/151public SQLRecoverableException(String reason, String SQLState, Throwable cause) {152super(reason, SQLState, cause);153}154155/**156* Constructs a {@code SQLRecoverableException} object157* with a given158* {@code reason}, {@code SQLState}, {@code vendorCode}159* and {@code cause}.160*161* @param reason a description of the exception162* @param SQLState an XOPEN or SQL:2003 code identifying the exception163* @param vendorCode a database vendor-specific exception code164* @param cause the underlying reason for this {@code SQLException} (which is saved for later retrieval by the {@code getCause()} method); may be null indicating165* the cause is non-existent or unknown.166* @since 1.6167*/168public SQLRecoverableException(String reason, String SQLState, int vendorCode, Throwable cause) {169super(reason, SQLState, vendorCode, cause);170}171172private static final long serialVersionUID = -4144386502923131579L;173}174175176