1*fb3fb4f3Stomee /*
2*fb3fb4f3Stomee  * CDDL HEADER START
3*fb3fb4f3Stomee  *
4*fb3fb4f3Stomee  * The contents of this file are subject to the terms of the
5*fb3fb4f3Stomee  * Common Development and Distribution License (the "License").
6*fb3fb4f3Stomee  * You may not use this file except in compliance with the License.
7*fb3fb4f3Stomee  *
8*fb3fb4f3Stomee  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*fb3fb4f3Stomee  * or http://www.opensolaris.org/os/licensing.
10*fb3fb4f3Stomee  * See the License for the specific language governing permissions
11*fb3fb4f3Stomee  * and limitations under the License.
12*fb3fb4f3Stomee  *
13*fb3fb4f3Stomee  * When distributing Covered Code, include this CDDL HEADER in each
14*fb3fb4f3Stomee  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*fb3fb4f3Stomee  * If applicable, add the following below this CDDL HEADER, with the
16*fb3fb4f3Stomee  * fields enclosed by brackets "[]" replaced with your own identifying
17*fb3fb4f3Stomee  * information: Portions Copyright [yyyy] [name of copyright owner]
18*fb3fb4f3Stomee  *
19*fb3fb4f3Stomee  * CDDL HEADER END
20*fb3fb4f3Stomee  */
21*fb3fb4f3Stomee 
22*fb3fb4f3Stomee /*
23*fb3fb4f3Stomee  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*fb3fb4f3Stomee  * Use is subject to license terms.
25*fb3fb4f3Stomee  *
26*fb3fb4f3Stomee  * ident	"%Z%%M%	%I%	%E% SMI"
27*fb3fb4f3Stomee  */
28*fb3fb4f3Stomee package org.opensolaris.os.dtrace;
29*fb3fb4f3Stomee 
30*fb3fb4f3Stomee /**
31*fb3fb4f3Stomee  * User-defined application behavior after an exception terminates
32*fb3fb4f3Stomee  * a running DTrace consumer.  The {@link Consumer} that threw the
33*fb3fb4f3Stomee  * exception is stopped automatically whether or not an {@code
34*fb3fb4f3Stomee  * ExceptionHandler} is set, but a handler must be set to do anything
35*fb3fb4f3Stomee  * other than print a stack trace to {@code stderr}.
36*fb3fb4f3Stomee  *
37*fb3fb4f3Stomee  * @see Consumer#go(ExceptionHandler handler)
38*fb3fb4f3Stomee  *
39*fb3fb4f3Stomee  * @author Tom Erickson
40*fb3fb4f3Stomee  */
41*fb3fb4f3Stomee public interface ExceptionHandler {
42*fb3fb4f3Stomee     /**
43*fb3fb4f3Stomee      * Defines what to do after an exception terminates a running {@link
44*fb3fb4f3Stomee      * Consumer}.  For example, a handler might be implemented to
45*fb3fb4f3Stomee      * display details about what went wrong.
46*fb3fb4f3Stomee      *
47*fb3fb4f3Stomee      * @param e  a {@link DTraceException} if encountered in the native
48*fb3fb4f3Stomee      * DTrace library, a {@link ConsumerException} if thrown from a
49*fb3fb4f3Stomee      * {@link ConsumerListener} method to terminate the consumer, or a
50*fb3fb4f3Stomee      * {@link RuntimeException} to indicate an unexpected error in the
51*fb3fb4f3Stomee      * Java DTrace API.
52*fb3fb4f3Stomee      */
handleException(Throwable e)53*fb3fb4f3Stomee     public void handleException(Throwable e);
54*fb3fb4f3Stomee }
55