ErrorHandler.java :  » Workflow-Engines » Dalma » dalma » Java Open Source

Java Open Source » Workflow Engines » Dalma 
Dalma » dalma » ErrorHandler.java
package dalma;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Handles uncaught exceptions thrown from conversations.
 *
 * <p>
 * Conversations may throw {@link RuntimeException} because
 * of a programming error, or it may throw {@link Error}
 * because of more serious problem. Installing an {@link ErrorHandler}
 * to an {@link Engine} allows the calling application to catch
 * and report any such problem.
 *
 * @see Engine#setErrorHandler(ErrorHandler)
 *
 * @author Kohsuke Kawaguchi
 */
public interface ErrorHandler {
    /**
     * This method is invoked by the engine every time
     * a conversation throws an uncaught exception.
     *
     * @param t
     *      always non-null.
     */
    void onError(Throwable t);

    /**
     * Default error handler that sends the error to {@link Logger}.
     */
    public static final ErrorHandler DEFAULT = new ErrorHandler() {
        public void onError(Throwable t) {
            Logger.getAnonymousLogger().log(Level.SEVERE,"a conversation reported an error",t);
        }
    };
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.