jdk/src/jdk.jdi/share/classes/com/sun/jdi/event/EventSet.java
author clanger
Fri, 16 Jun 2017 14:09:31 +0200
changeset 45564 0149773a140c
parent 34894 3248b89d1921
permissions -rw-r--r--
8181417: Code cleanups in com.sun.jdi Reviewed-by: alanb, stuefe, sspitsyn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
     2
 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package com.sun.jdi.event;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    28
import java.util.Set;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    30
import com.sun.jdi.Location;
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    31
import com.sun.jdi.Mirror;
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    32
import com.sun.jdi.ThreadReference;
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    33
import com.sun.jdi.VirtualMachine;
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    34
import com.sun.jdi.request.BreakpointRequest;
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    35
import com.sun.jdi.request.EventRequest;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * Several {@link Event} objects may be created at a given time by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * the target {@link VirtualMachine}. For example, there may be
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    40
 * more than one {@link BreakpointRequest} for a given {@link Location}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * or you might single step to the same location as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * BreakpointRequest.  These {@link Event} objects are delivered
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * together as an EventSet.  For uniformity, an EventSet is always used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * to deliver {@link Event} objects.  EventSets are delivered by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * the {@link EventQueue}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * EventSets are unmodifiable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * Associated with the issuance of an event set, suspensions may
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * have occurred in the target VM.  These suspensions correspond
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * with the {@link #suspendPolicy() suspend policy}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * To assure matching resumes occur, it is recommended,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * where possible,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * to complete the processing of an event set with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * {@link #resume() EventSet.resume()}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * The events that are grouped in an EventSet are restricted in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * following ways:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * <LI>Always singleton sets:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *     <LI>{@link VMStartEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *     <LI>{@link VMDisconnectEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * <LI>Only with other VMDeathEvents:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *     <LI>{@link VMDeathEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * <LI>Only with other ThreadStartEvents for the same thread:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *     <LI>{@link ThreadStartEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * <LI>Only with other ThreadDeathEvents for the same thread:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *     <LI>{@link ThreadDeathEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * <LI>Only with other ClassPrepareEvents for the same class:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 *     <LI>{@link ClassPrepareEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * <LI>Only with other ClassUnloadEvents for the same class:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *     <LI>{@link ClassUnloadEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * <LI>Only with other AccessWatchpointEvents for the same field access:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *     <LI>{@link AccessWatchpointEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * <LI>Only with other ModificationWatchpointEvents for the same field
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * modification:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *     <LI>{@link ModificationWatchpointEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * <LI>Only with other ExceptionEvents for the same exception occurrance:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 *     <LI>{@link ExceptionEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * <LI>Only with other MethodExitEvents for the same method exit:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 *     <LI>{@link MethodExitEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * <LI>Only with other Monitor contended enter events for the same monitor object:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 *     <LI>Monitor Contended Enter Event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * <LI>Only with other Monitor contended entered events for the same monitor object:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 *     <LI>Monitor Contended Entered Event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 *    </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 * <LI>Only with other Monitor wait events for the same monitor object:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 *     <LI>Monitor Wait Event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * <LI>Only with other Monitor waited events for the same monitor object:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 *     <LI>Monitor Waited Event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * <LI>Only with other members of this group, at the same location
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * and in the same thread:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 *     <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 *     <LI>{@link BreakpointEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *     <LI>{@link StepEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 *     <LI>{@link MethodEntryEvent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 *     </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 * </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 * @see Event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 * @see EventQueue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 * @author Robert Field
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 * @since  1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
public interface EventSet extends Mirror, Set<Event> {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * Returns the policy used to suspend threads in the target VM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * for this event set. This policy is selected from the suspend
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * policies for each event's request; the target VM chooses the
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   138
     * policy which suspends the most threads.  The target VM suspends
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   139
     * threads according to that policy and that policy is returned here.
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   140
     * See {@link EventRequest} for the possible policy values.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * In rare cases, the suspend policy may differ from the requested
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * value if a {@link ClassPrepareEvent} has occurred in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * debugger system thread. See {@link ClassPrepareEvent#thread}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * @return the suspendPolicy which is either
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   148
     * {@link EventRequest#SUSPEND_ALL SUSPEND_ALL},
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   149
     * {@link EventRequest#SUSPEND_EVENT_THREAD SUSPEND_EVENT_THREAD} or
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   150
     * {@link EventRequest#SUSPEND_NONE SUSPEND_NONE}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    int suspendPolicy();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * Return an iterator specific to {@link Event} objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    EventIterator eventIterator();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * Resumes threads suspended by this event set. If the {@link #suspendPolicy}
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   161
     * is {@link EventRequest#SUSPEND_ALL}, a call to this method is equivalent to
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   162
     * {@link VirtualMachine#resume}. If the suspend policy is
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   163
     * {@link EventRequest#SUSPEND_EVENT_THREAD},
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * a call to this method is equivalent to
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   165
     * {@link ThreadReference#resume} for the event thread.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * Otherwise, a call to this method is a no-op.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    void resume();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
}