fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * CDDL HEADER START
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * The contents of this file are subject to the terms of the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Common Development and Distribution License (the "License").
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * You may not use this file except in compliance with the License.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * See the License for the specific language governing permissions
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * and limitations under the License.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * When distributing Covered Code, include this CDDL HEADER in each
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * If applicable, add the following below this CDDL HEADER, with the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * fields enclosed by brackets "[]" replaced with your own identifying
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * information: Portions Copyright [yyyy] [name of copyright owner]
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * CDDL HEADER END
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Use is subject to license terms.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * ident "%Z%%M% %I% %E% SMI"
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Description of control flow across function boundaries including
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * direction (entry or return) and depth in the call stack. This
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * information is added to {@link ProbeData} instances only when the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * {@link Option#flowindent flowindent} option is used:
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * <pre><code>
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Consumer consumer = new LocalConsumer();
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * consumer.open();
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * consumer.setOption(Option.flowindent);
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * </code></pre>
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * See the <a
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * href="http://docs.sun.com/app/docs/doc/817-6223/6mlkidlk1?a=view">
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * <b>Examples</b></a> section of the <b>{@code fbt}
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Provider</b> chapter of the <i>Solaris Dynamic Tracing Guide</i>.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Immutable. Supports persistence using {@link java.beans.XMLEncoder}.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @see Consumer#setOption(String option)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @see Option#flowindent
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @author Tom Erickson
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee static final long serialVersionUID = -9178272444872063901L;
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Indicates direction of flow across a boundary, such as entering
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * or returing from a function.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee /** Entry into a function. */
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee /** Return from a function. */
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee /** No function boundary crossed. */
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Need to prevent DefaultPersistenceDelegate from using
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * overridden equals() method, resulting in a
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * StackOverFlowError. Revert to PersistenceDelegate
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * implementation. See
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * 477019&tstart=135
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee protected boolean
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee return new Expression(oldInstance, oldInstance.getClass(),
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee d.setValue("persistenceDelegate", persistenceDelegate);
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee /** @serial */
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee /** @serial */
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Creates a {@code Flow} instance with the given flow kind and
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * depth. Supports XML persistence.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @param flowKindName name of enumeration value indicating the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * direction of flow
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @param flowDepth current depth in the call stack
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @throws IllegalArgumentException if there is no {@code Flow.Kind}
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * value with the given name or if the given {@code flowDepth} is
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @throws NullPointerException if the given {@code Flow.Kind} name
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * is {@code null}
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee throw new IllegalArgumentException("depth is negative");
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Gets the direction of the flow of control (entry or return)
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * across a function boundary.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @return non-null flow kind indicating direction of flow (entry or
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * return) across a function boundary
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Gets the current depth in the call stack.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @return A non-negative sum of the function entries minus the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * function returns up until the moment described by this control
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * flow instance. For example, if the traced flow of control
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * entered two functions but only returned from one, the depth is
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * one (2 entries minus 1 return).
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Compares the specified object with this {@code Flow} instance for
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * equality. Defines equality as having the same flow kind and
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * @return {@code true} if and only if the specified object is of
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * type {@code Flow} and both instances have equal flow kind and
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee public boolean
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee if (o instanceof Flow) {
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee return false;
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Overridden to ensure that equal instances have equal hash codes.
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee private void
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee // check class invariants
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee throw new InvalidObjectException("depth is negative");
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * Gets a string representation of this {@code Flow} instance useful
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * for logging and not intended for display. The exact details of
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * the representation are unspecified and subject to change, but the
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * following format may be regarded as typical:
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * <pre><code>
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * class-name[property1 = value1, property2 = value2]
fb3fb4f3d76d55b64440afd0af72775dfad3bd1dtomee * </code></pre>