001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * https://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.lang3.concurrent; 018 019/** 020 * An exception class used for reporting runtime error conditions related to 021 * accessing data of background tasks. 022 * 023 * <p> 024 * This class is an analogue of the {@link ConcurrentException} exception class. 025 * However, it is a runtime exception and thus does not need explicit catch 026 * clauses. Some methods of {@link ConcurrentUtils} throw {@code 027 * ConcurrentRuntimeException} exceptions rather than 028 * {@link ConcurrentException} exceptions. They can be used by client code that 029 * does not want to be bothered with checked exceptions. 030 * </p> 031 * 032 * @since 3.0 033 */ 034public class ConcurrentRuntimeException extends RuntimeException { 035 036 /** 037 * The serial version UID. 038 */ 039 private static final long serialVersionUID = -6582182735562919670L; 040 041 /** 042 * Creates a new, uninitialized instance of {@code 043 * ConcurrentRuntimeException}. 044 */ 045 protected ConcurrentRuntimeException() { 046 } 047 048 /** 049 * Creates a new instance of {@link ConcurrentRuntimeException} and 050 * initializes it with the given message and cause. 051 * 052 * @param msg the error message 053 * @param cause the cause of this exception 054 * @throws IllegalArgumentException if the cause is not a checked exception 055 */ 056 public ConcurrentRuntimeException(final String msg, final Throwable cause) { 057 super(msg, ConcurrentUtils.checkedException(cause)); 058 } 059 060 /** 061 * Creates a new instance of {@link ConcurrentRuntimeException} and 062 * initializes it with the given cause. 063 * 064 * @param cause the cause of this exception 065 * @throws IllegalArgumentException if the cause is not a checked exception 066 */ 067 public ConcurrentRuntimeException(final Throwable cause) { 068 super(ConcurrentUtils.checkedException(cause)); 069 } 070}