Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/sql/SQLRecoverableException.java
38829 views
/*1* Copyright (c) 2006, 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*/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*<p>35*36* @since 1.637*/38public class SQLRecoverableException extends java.sql.SQLException {3940/**41* Constructs a <code>SQLRecoverableException</code> object.42* The <code>reason</code>, <code>SQLState</code> are initialized43* to <code>null</code> and the vendor code is initialized to 0.44*45* The <code>cause</code> is not initialized, and may subsequently be46* initialized by a call to the47* {@link Throwable#initCause(java.lang.Throwable)} method.48* <p>49* @since 1.650*/51public SQLRecoverableException() {52super();53}5455/**56* Constructs a <code>SQLRecoverableException</code> object57* with a given <code>reason</code>. The <code>SQLState</code>58* is initialized to <code>null</code> and the vendor code is initialized59* to 0.60*61* The <code>cause</code> is not initialized, and may subsequently be62* initialized by a call to the63* {@link Throwable#initCause(java.lang.Throwable)} method.64* <p>65* @param reason a description of the exception66* @since 1.667*/68public SQLRecoverableException(String reason) {69super(reason);70}7172/**73* Constructs a <code>SQLRecoverableException</code> object74* with a given <code>reason</code> and <code>SQLState</code>.75*76* The <code>cause</code> is not initialized, and may subsequently be77* initialized by a call to the78* {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code79* is initialized to 0.80* <p>81* @param reason a description of the exception82* @param SQLState an XOPEN or SQL:2003 code identifying the exception83* @since 1.684*/85public SQLRecoverableException(String reason, String SQLState) {86super(reason, SQLState);87}8889/**90* Constructs a <code>SQLRecoverableException</code> object91* with a given <code>reason</code>, <code>SQLState</code> and92* <code>vendorCode</code>.93*94* The <code>cause</code> is not initialized, and may subsequently be95* initialized by a call to the96* {@link Throwable#initCause(java.lang.Throwable)} method.97* <p>98* @param reason a description of the exception99* @param SQLState an XOPEN or SQL:2003 code identifying the exception100* @param vendorCode a database vendor specific exception code101* @since 1.6102*/103public SQLRecoverableException(String reason, String SQLState, int vendorCode) {104super(reason, SQLState, vendorCode);105}106107/**108* Constructs a <code>SQLRecoverableException</code> object109* with a given <code>cause</code>.110* The <code>SQLState</code> is initialized111* to <code>null</code> and the vendor code is initialized to 0.112* The <code>reason</code> is initialized to <code>null</code> if113* <code>cause==null</code> or to <code>cause.toString()</code> if114* <code>cause!=null</code>.115* <p>116* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating117* the cause is non-existent or unknown.118* @since 1.6119*/120public SQLRecoverableException(Throwable cause) {121super(cause);122}123124/**125* Constructs a <code>SQLRecoverableException</code> object126* with a given127* <code>reason</code> and <code>cause</code>.128* The <code>SQLState</code> is initialized to <code>null</code>129* and the vendor code is initialized to 0.130* <p>131* @param reason a description of the exception.132* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating133* the cause is non-existent or unknown.134* @since 1.6135*/136public SQLRecoverableException(String reason, Throwable cause) {137super(reason, cause);138}139140/**141* Constructs a <code>SQLRecoverableException</code> object142* with a given143* <code>reason</code>, <code>SQLState</code> and <code>cause</code>.144* The vendor code is initialized to 0.145* <p>146* @param reason a description of the exception.147* @param SQLState an XOPEN or SQL:2003 code identifying the exception148* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating149* the cause is non-existent or unknown.150* @since 1.6151*/152public SQLRecoverableException(String reason, String SQLState, Throwable cause) {153super(reason, SQLState, cause);154}155156/**157* Constructs a <code>SQLRecoverableException</code> object158* with a given159* <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code>160* and <code>cause</code>.161* <p>162* @param reason a description of the exception163* @param SQLState an XOPEN or SQL:2003 code identifying the exception164* @param vendorCode a database vendor-specific exception code165* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating166* the cause is non-existent or unknown.167* @since 1.6168*/169public SQLRecoverableException(String reason, String SQLState, int vendorCode, Throwable cause) {170super(reason, SQLState, vendorCode, cause);171}172173private static final long serialVersionUID = -4144386502923131579L;174}175176177