⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 schedulerexception.java

📁 定时器开源项目, 相对于 jcrontab, Quartz 算是更完整的一个项目, 随著开发的版本上来, 他已经脱离只是写在程序里面的计时器, 在指定的时间或区间, 处理所指定的事件. 也加入了 se
💻 JAVA
字号:
/* * Copyright James House (c) 2001-2004 *  * All rights reserved. *  * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: 1. * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. 2. Redistributions in * binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other * materials provided with the distribution. *  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */package org.quartz;import java.io.PrintStream;import java.io.PrintWriter;/** * <p> * Base class for exceptions thrown by the Quartz <code>{@link Scheduler}</code>. * </p> *  * <p> * <code>SchedulerException</code> s may contain a reference to another * <code>Exception</code>, which was the underlying cause of the <code>SchedulerException</code>. * </p> *  * @author James House */public class SchedulerException extends Exception {    /*     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     *      * Constants.     *      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     */    public static final int ERR_UNSPECIFIED = 0;    public static final int ERR_BAD_CONFIGURATION = 50;    public static final int ERR_TIME_BROKER_FAILURE = 70;    public static final int ERR_CLIENT_ERROR = 100;    public static final int ERR_COMMUNICATION_FAILURE = 200;    public static final int ERR_UNSUPPORTED_FUNCTION_IN_THIS_CONFIGURATION = 210;    public static final int ERR_PERSISTENCE = 400;    public static final int ERR_PERSISTENCE_JOB_DOES_NOT_EXIST = 410;    public static final int ERR_PERSISTENCE_CALENDAR_DOES_NOT_EXIST = 420;    public static final int ERR_PERSISTENCE_TRIGGER_DOES_NOT_EXIST = 430;    public static final int ERR_PERSISTENCE_CRITICAL_FAILURE = 499;    public static final int ERR_THREAD_POOL = 500;    public static final int ERR_THREAD_POOL_EXHAUSTED = 510;    public static final int ERR_THREAD_POOL_CRITICAL_FAILURE = 599;    public static final int ERR_JOB_LISTENER = 600;    public static final int ERR_JOB_LISTENER_NOT_FOUND = 610;    public static final int ERR_TRIGGER_LISTENER = 700;    public static final int ERR_TRIGGER_LISTENER_NOT_FOUND = 710;    public static final int ERR_JOB_EXECUTION_THREW_EXCEPTION = 800;    public static final int ERR_TRIGGER_THREW_EXCEPTION = 850;    /*     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     *      * Data members.     *      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     */    private Exception cause;    private int errorCode = ERR_UNSPECIFIED;    /*     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     *      * Constructors.     *      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     */    public SchedulerException() {        super();    }    public SchedulerException(String msg) {        super(msg);    }    public SchedulerException(String msg, int errorCode) {        super(msg);        setErrorCode(errorCode);    }    public SchedulerException(Exception cause) {        super(cause.toString());        this.cause = cause;    }    public SchedulerException(String msg, Exception cause) {        super(msg);        this.cause = cause;    }    public SchedulerException(String msg, Exception cause, int errorCode) {        super(msg);        this.cause = cause;        setErrorCode(errorCode);    }    /*     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     *      * Interface.     *      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     */    /**     * <p>     * Return the exception that is the underlying cause of this exception.     * </p>     *      * <p>     * This may be used to find more detail about the cause of the error.     * </p>     *      * @return the underlying exception, or <code>null</code> if there is not     *         one.     */    public Throwable getUnderlyingException() {        return cause;    }    /**     * <p>     * Get the error code associated with this exception.     * </p>     *      * <p>     * This may be used to find more detail about the cause of the error.     * </p>     *      * @return one of the ERR_XXX constants defined in this class.     */    public int getErrorCode() {        return errorCode;    }    /**     * <p>     * Get the error code associated with this exception.     * </p>     *      * <p>     * This may be used to provide more detail about the cause of the error.     * </p>     *      * @param errorCode     *          one of the ERR_XXX constants defined in this class.     */    public void setErrorCode(int errorCode) {        this.errorCode = errorCode;    }    /**     * <p>     * Determine if the specified error code is in the <code>'ERR_PERSISTENCE'</code>     * category of errors.     * </p>     */    public boolean isPersistenceError() {        return (errorCode >= ERR_PERSISTENCE && errorCode <= ERR_PERSISTENCE + 99);    }    /**     * <p>     * Determine if the specified error code is in the <code>'ERR_THREAD_POOL'</code>     * category of errors.     * </p>     */    public boolean isThreadPoolError() {        return (errorCode >= ERR_THREAD_POOL && errorCode <= ERR_THREAD_POOL + 99);    }    /**     * <p>     * Determine if the specified error code is in the <code>'ERR_JOB_LISTENER'</code>     * category of errors.     * </p>     */    public boolean isJobListenerError() {        return (errorCode >= ERR_JOB_LISTENER && errorCode <= ERR_JOB_LISTENER + 99);    }    /**     * <p>     * Determine if the specified error code is in the <code>'ERR_TRIGGER_LISTENER'</code>     * category of errors.     * </p>     */    public boolean isTriggerListenerError() {        return (errorCode >= ERR_TRIGGER_LISTENER && errorCode <= ERR_TRIGGER_LISTENER + 99);    }    /**     * <p>     * Determine if the specified error code is in the <code>'ERR_CLIENT_ERROR'</code>     * category of errors.     * </p>     */    public boolean isClientError() {        return (errorCode >= ERR_CLIENT_ERROR && errorCode <= ERR_CLIENT_ERROR + 99);    }    /**     * <p>     * Determine if the specified error code is in the <code>'ERR_CLIENT_ERROR'</code>     * category of errors.     * </p>     */    public boolean isConfigurationError() {        return (errorCode >= ERR_BAD_CONFIGURATION && errorCode <= ERR_BAD_CONFIGURATION + 49);    }    public String toString() {        if (cause == null) return super.toString();        else            return super.toString() + " [See nested exception: "                    + cause.toString() + "]";    }    /**     * <P>     * Print a stack trace to the standard error stream.     * </P>     *      * <P>     * This overridden version will print the nested stack trace if available,     * otherwise it prints only this exception's stack.     * </P>     */    public void printStackTrace() {        printStackTrace(System.err);    }    /**     * <P>     * Print a stack trace to the specified stream.     * </P>     *      * <P>     * This overridden version will print the nested stack trace if available,     * otherwise it prints only this exception's stack.     * </P>     *      * @param out     *          the stream to which the stack traces will be printed.     */    public void printStackTrace(PrintStream out) {        super.printStackTrace(out);        if ((cause != null)) {            synchronized (out) {                out                        .println("* Nested Exception (Underlying Cause) ---------------");                cause.printStackTrace(out);            }        }    }    /**     * <P>     * Print a stack trace to the specified writer.     * </P>     *      * <P>     * This overridden version will print the nested stack trace if available,     * otherwise it prints this exception's stack.     * </P>     *      * @param out     *          the writer to which the stack traces will be printed.     */    public void printStackTrace(PrintWriter out) {        super.printStackTrace(out);        if ((cause != null)) {            synchronized (out) {                out                        .println("* Nested Exception (Underlying Cause) ---------------");                cause.printStackTrace(out);            }        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -