1 /* 2 * Copyright 2002-2006 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.springframework.transaction; 18 19 /** 20 * Exception to be thrown when a transaction has timed out. 21 * 22 * <p>Thrown by Spring's local transaction strategies if the deadline 23 * for a transaction has been reached when an operation is attempted, 24 * according to the timeout specified for the given transaction. 25 * 26 * <p>Beyond such checks before each transactional operation, Spring's 27 * local transaction strategies will also pass appropriate timeout values 28 * to resource operations (for example to JDBC Statements, letting the JDBC 29 * driver respect the timeout). Such operations will usually throw native 30 * resource exceptions (for example, JDBC SQLExceptions) if their operation 31 * timeout has been exceeded, to be converted to Spring's DataAccessException 32 * in the respective DAO (which might use Spring's JdbcTemplate, for example). 33 * 34 * <p>In a JTA environment, it is up to the JTA transaction coordinator 35 * to apply transaction timeouts. Usually, the corresponding JTA-aware 36 * connection pool will perform timeout checks and throw corresponding 37 * native resource exceptions (for example, JDBC SQLExceptions). 38 * 39 * @author Juergen Hoeller 40 * @since 1.1.5 41 * @see org.springframework.transaction.support.ResourceHolderSupport#getTimeToLiveInMillis 42 * @see java.sql.Statement#setQueryTimeout 43 * @see java.sql.SQLException 44 */ 45 public class TransactionTimedOutException extends TransactionException { 46 47 /** 48 * Constructor for TransactionTimedOutException. 49 * @param msg the detail message 50 */ 51 public TransactionTimedOutException(String msg) { 52 super(msg); 53 } 54 55 /** 56 * Constructor for TransactionTimedOutException. 57 * @param msg the detail message 58 * @param cause the root cause from the transaction API in use 59 */ 60 public TransactionTimedOutException(String msg, Throwable cause) { 61 super(msg, cause); 62 } 63 64 } 65