1 /* 2 * Copyright (c) 1998, 2013, 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.jdi; 27 28 import java.util.List; 29 30 /** 31 * A thread group object from the target VM. 32 * A ThreadGroupReference is an {@link ObjectReference} with additional 33 * access to threadgroup-specific information from the target VM. 34 * 35 * @author Robert Field 36 * @author Gordon Hirsch 37 * @author James McIlree 38 * @since 1.3 39 */ 40 @jdk.Exported 41 public interface ThreadGroupReference extends ObjectReference { 42 43 /** 44 * Returns the name of this thread group. 45 * 46 * @return the string containing the thread group name. 47 */ name()48 String name(); 49 50 /** 51 * Returns the parent of this thread group. 52 * 53 * @return a {@link ThreadGroupReference} mirroring the parent of this 54 * thread group in the target VM, or null if this is a top-level 55 * thread group. 56 */ parent()57 ThreadGroupReference parent(); 58 59 /** 60 * Suspends all threads in this thread group. Each thread 61 * in this group and in all of its subgroups will be 62 * suspended as described in {@link ThreadReference#suspend}. 63 * This is not guaranteed to be an atomic 64 * operation; if the target VM is not interrupted at the time 65 * this method is 66 * called, it is possible that new threads will be created 67 * between the time that threads are enumerated and all of them 68 * have been suspended. 69 * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. 70 */ suspend()71 void suspend(); 72 73 /** 74 * Resumes all threads in this thread group. Each thread 75 * in this group and in all of its subgroups will be 76 * resumed as described in {@link ThreadReference#resume}. 77 * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. 78 */ resume()79 void resume(); 80 81 /** 82 * Returns a List containing a {@link ThreadReference} for each live thread 83 * in this thread group. Only the live threads in this immediate thread group 84 * (and not its subgroups) are returned. A thread is alive if it 85 * has been started and has not yet been stopped. 86 * 87 * @return a List of {@link ThreadReference} objects mirroring the 88 * live threads from this thread group in the target VM. 89 */ threads()90 List<ThreadReference> threads(); 91 92 /** 93 * Returns a List containing each active {@link ThreadGroupReference} in this 94 * thread group. Only the active thread groups in this immediate thread group 95 * (and not its subgroups) are returned. 96 * See <a href="{@docRoot}/../../../../api/java/lang/ThreadGroup.html">java.lang.ThreadGroup</a> 97 * for information about 'active' ThreadGroups. 98 * @return a List of {@link ThreadGroupReference} objects mirroring the 99 * active thread groups from this thread group in the target VM. 100 */ threadGroups()101 List<ThreadGroupReference> threadGroups(); 102 } 103