exceptionevent.java

来自「sea是一个基于seda模式的实现。这个设计模式将系统分为很多stage。每个s」· Java 代码 · 共 91 行

JAVA
91
字号
/* * Copyright (c) 2003, The Regents of the University of California, through * Lawrence Berkeley National Laboratory (subject to receipt of any required * approvals from the U.S. Dept. of Energy). All rights reserved. */package gov.lbl.dsd.sea.event;import gov.lbl.dsd.sea.Stage;/** * A generic runtime exception that can be thrown when a problem occurs within * {@link gov.lbl.dsd.sea.EventHandler#handle(java.lang.Object)}. * <p> * If appropriate, you can enqueue an instance of this class onto a stage. * * @author whoschek@lbl.gov * @author $Author: hoschek3 $ * @version $Revision: 1.2 $, $Date: 2004/07/22 18:04:54 $ */public class ExceptionEvent extends RuntimeException {    protected Object causingEvent;    protected Stage source;    /**     * Constructs a new exception.     *     * @param causingEvent     *            the event that caused the exception.     * @param source     *            the stage that could not properly handle the causing event.     */    public ExceptionEvent(Object causingEvent, Stage source) {        this(null, null, causingEvent, source);    }    /**     * Constructs a new exception.     *     * @param  cause the cause (which is saved for later retrieval by the     *         {@link #getCause()} method).  (A <tt>null</tt> value is     *         permitted, and indicates that the cause is nonexistent or     *         unknown.)     * @param causingEvent     *            the event that caused the exception.     * @param source     *            the stage that could not properly handle the causing event.     */    public ExceptionEvent(Throwable cause, Object causingEvent, Stage source) {        this(null, cause, causingEvent, source);    }    /**     * Constructs a new exception.     *     * @param message     *            the detail message. The detail message is saved for later     *            retrieval by the {@link #getMessage()}method.     * @param  cause the cause (which is saved for later retrieval by the     *         {@link #getCause()} method).  (A <tt>null</tt> value is     *         permitted, and indicates that the cause is nonexistent or     *         unknown.)     * @param causingEvent     *            the event that caused the exception.     * @param source     *            the stage that could not properly handle the causing event.     */    public ExceptionEvent(String message, Throwable cause, Object causingEvent, Stage source) {        super(message, cause);        this.causingEvent = causingEvent;        this.source = source;    }    public Object getCausingEvent() {        return this.causingEvent;    }    public Stage getSource() {        return this.source;    }    public String toString() {        String str = super.toString();        if (getCausingEvent() != null) str = str + ", causingEventType=" + getCausingEvent().getClass().getName();        if (getCausingEvent() != null) str = str + ", causingEvent=" + getCausingEvent();        if (getSource() != null) str = str + ", source=" + getSource();        return str;    }}

⌨️ 快捷键说明

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