jdk/src/jdk.runtime/share/classes/com/sun/tracing/Provider.java
changeset 29033 e70dcf797a33
parent 28967 7a1ceff4aea2
parent 29032 67b9b02c13fe
child 29034 17c1e9d67f71
child 29105 3927f8f0bf4b
equal deleted inserted replaced
28967:7a1ceff4aea2 29033:e70dcf797a33
     1 /*
       
     2  * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 
       
    26 package com.sun.tracing;
       
    27 
       
    28 /**
       
    29  * {@code Provider} is a superinterface for user-defined tracing providers.
       
    30  * <p>
       
    31  * To define tracepoints, users must extend this interface
       
    32  * and then use a {@code ProviderFactory} to create an instance of the
       
    33  * newly-defined interface.  Each method in the defined interface represents a
       
    34  * tracepoint (or probe), which can be triggered by calling the associated
       
    35  * method on the returned instance.
       
    36  * <p>
       
    37  * This interface also contains a {@code getProbe()} method, which can be
       
    38  * used to get direct handles to the {@code Probe} objects themselves.
       
    39  * {@code Probe} objects can be triggered manually, or they can be queried to
       
    40  * check their state.
       
    41  * <p>
       
    42  * When an application has finished triggering probes, it should call
       
    43  * {@code dispose()} to free up any system resources associated with the
       
    44  * Provider.
       
    45  * <p>
       
    46  * All methods declared in a subclass of this interface should have a
       
    47  * {@code void} return type. Methods can have parameters, and when called the
       
    48  * values of the arguments will be passed to the tracing implementation.
       
    49  * If any methods do not have a {@code void} return type, an
       
    50  * {@code java.lang.IllegalArgumentException} will be thrown when the
       
    51  * provider is registered.
       
    52  * @since 1.7
       
    53  */
       
    54 
       
    55 public interface Provider {
       
    56     /**
       
    57      * Retrieves a reference to a Probe object, which is used to check status
       
    58      * or to trigger the probe manually.
       
    59      *
       
    60      * If the provided method parameter is not a method of the provider
       
    61      * interface,  or if the provider interface has been disposed, then
       
    62      * this returns null
       
    63      *
       
    64      * @param method a method declared in the provider.
       
    65      * @return the specified probe represented by that method, or null.
       
    66      */
       
    67     Probe getProbe(java.lang.reflect.Method method);
       
    68 
       
    69     /**
       
    70      * Disposes system resources associated with this provider.
       
    71      *
       
    72      * After calling this method, triggering the probes will have no effect.
       
    73      * Additional calls to this method after the first call are ignored.
       
    74      */
       
    75     void dispose();
       
    76 }