TestDrop.java revision 4ae67516a1d5dc4a5dbc761762bad5b596647388
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * CDDL HEADER START
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * The contents of this file are subject to the terms of the
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * Common Development and Distribution License (the "License").
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * You may not use this file except in compliance with the License.
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * See the License for the specific language governing permissions
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * and limitations under the License.
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * When distributing Covered Code, include this CDDL HEADER in each
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * If applicable, add the following below this CDDL HEADER, with the
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * fields enclosed by brackets "[]" replaced with your own identifying
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * information: Portions Copyright [yyyy] [name of copyright owner]
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * CDDL HEADER END
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * Use is subject to license terms.
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * ident "%Z%%M% %I% %E% SMI"
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * Regression test for 6521523 aggregation drops can hang the Java
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee * DTrace API.
4ae67516a1d5dc4a5dbc761762bad5b596647388tomeepublic class TestDrop {
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee "fbt:genunix::entry { @[execname, pid] = count(); }";
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee static AtomicLong consumerThreadID = new AtomicLong();
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee static AtomicLong getAggregateThreadID = new AtomicLong();
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee static int seconds;
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee private static void
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee public void run() {
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee private static void
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee sampleAggregate(Consumer consumer) throws DTraceException
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee consumer.getAggregate(Collections. <String> emptySet());
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee private static void
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee public void run() {
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee } catch (Throwable e) {
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee if (x != null) {
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee Thread t = new Thread(aggregateSampler, "Aggregate Sampler");
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee static void
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee System.err.println("usage: java TestDrop [ seconds ]");
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee public static void
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee public void run() {
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee public void dataDropped(DropEvent e) throws ConsumerException {
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee consumer.setOption(Option.aggrate, Option.millis(101));
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee } catch (DTraceException e) {