001/*
002 * Copyright 2002-2012 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.transaction;
018
019/**
020 * Exception to be thrown when a transaction has timed out.
021 *
022 * <p>Thrown by Spring's local transaction strategies if the deadline
023 * for a transaction has been reached when an operation is attempted,
024 * according to the timeout specified for the given transaction.
025 *
026 * <p>Beyond such checks before each transactional operation, Spring's
027 * local transaction strategies will also pass appropriate timeout values
028 * to resource operations (for example to JDBC Statements, letting the JDBC
029 * driver respect the timeout). Such operations will usually throw native
030 * resource exceptions (for example, JDBC SQLExceptions) if their operation
031 * timeout has been exceeded, to be converted to Spring's DataAccessException
032 * in the respective DAO (which might use Spring's JdbcTemplate, for example).
033 *
034 * <p>In a JTA environment, it is up to the JTA transaction coordinator
035 * to apply transaction timeouts. Usually, the corresponding JTA-aware
036 * connection pool will perform timeout checks and throw corresponding
037 * native resource exceptions (for example, JDBC SQLExceptions).
038 *
039 * @author Juergen Hoeller
040 * @since 1.1.5
041 * @see org.springframework.transaction.support.ResourceHolderSupport#getTimeToLiveInMillis
042 * @see java.sql.Statement#setQueryTimeout
043 * @see java.sql.SQLException
044 */
045@SuppressWarnings("serial")
046public class TransactionTimedOutException extends TransactionException {
047
048        /**
049         * Constructor for TransactionTimedOutException.
050         * @param msg the detail message
051         */
052        public TransactionTimedOutException(String msg) {
053                super(msg);
054        }
055
056        /**
057         * Constructor for TransactionTimedOutException.
058         * @param msg the detail message
059         * @param cause the root cause from the transaction API in use
060         */
061        public TransactionTimedOutException(String msg, Throwable cause) {
062                super(msg, cause);
063        }
064
065}