/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* An EventSet is normally created by the transport reader thread when
* it reads a JDWP Composite command. The constructor doesn't unpack
* the events contained in the Composite command and create EventImpls
* for them because that process might involve calling back into the back-end
* which should not be done by the transport reader thread. Instead,
* the raw bytes of the packet are read and stored in the EventSet.
* The EventSet is then added to each EventQueue. When an EventSet is
* removed from an EventQueue, the EventSetImpl.build() method is called.
* This method reads the packet bytes and creates the actual EventImpl objects.
* build() also filters out events for our internal handler and puts them in
* their own EventSet. This means that the EventImpls that are in the EventSet
* that is on the queues are all for client requests.
*/
private byte suspendPolicy;
boolean first = true;
if (!first) {
string += ", ";
}
first = false;
}
string += "}";
return string;
}
private final byte eventCmd;
private final int requestID;
// This is set only for client requests, not internal requests.
/**
* Constructor for events.
*/
int requestID) {
super(EventSetImpl.this.vm);
}
/*
* Override superclass back to default equality
*/
return this == obj;
}
public int hashCode() {
return System.identityHashCode(this);
}
/**
* Constructor for VM disconnected events.
*/
super(EventSetImpl.this.vm);
this.requestID = 0;
}
return request;
}
int requestID() {
return requestID;
}
/*
* We need to decide if this event is for
* 1. an internal request
* 2. a client request that is no longer available, ie
* it has been deleted, or disabled and re-enabled
* which gives it a new ID.
* 3. a current client request that is disabled
* 4. a current enabled client request.
*
* We will filter this set into a set
* that contains only 1s for our internal queue
* and a set that contains only 4s for our client queue.
* If we get an EventSet that contains only 2 and 3
* then we have to resume it if it is not SUSPEND_NONE
* because no one else will.
*/
if (requestID == 0) {
/* An unsolicited event. These have traditionally
* been treated as client events.
*/
return EventDestination.CLIENT_EVENT;
}
// Is this an event for a current client request?
// Nope. Is it an event for an internal request?
// Yep
return EventDestination.INTERNAL_EVENT;
}
return EventDestination.UNKNOWN_EVENT;
}
// We found a client request
return EventDestination.CLIENT_EVENT;
}
return EventDestination.UNKNOWN_EVENT;
}
return eventName();
}
}
}
return thread;
}
}
}
implements Locatable {
int requestID,
}
return location;
}
/**
* For MethodEntry and MethodExit
*/
}
return eventName() + "@" +
}
}
implements BreakpointEvent {
}
return "BreakpointEvent";
}
}
}
return "StepEvent";
}
}
implements MethodEntryEvent {
}
return "MethodEntryEvent";
}
}
implements MethodExitEvent {
}
}
return "MethodExitEvent";
}
if (!this.vm.canGetMethodReturnValues()) {
throw new UnsupportedOperationException(
"target does not support return values in MethodExit events");
}
return returnVal;
}
}
implements MonitorContendedEnterEvent {
}
return "MonitorContendedEnter";
}
return monitor;
};
}
implements MonitorContendedEnteredEvent {
}
return "MonitorContendedEntered";
}
return monitor;
};
}
implements MonitorWaitEvent {
private long timeout;
}
return "MonitorWait";
}
return monitor;
};
public long timeout() {
return timeout;
}
}
implements MonitorWaitedEvent {
private boolean timed_out;
}
return "MonitorWaited";
}
return monitor;
};
public boolean timedout() {
return timed_out;
}
}
implements ClassPrepareEvent {
}
return referenceType;
}
return "ClassPrepareEvent";
}
}
}
}
return classSignature;
}
return "ClassUnloadEvent";
}
}
implements ExceptionEvent {
}
return exception;
}
return catchLocation;
}
return "ExceptionEvent";
}
}
implements ThreadDeathEvent {
}
return "ThreadDeathEvent";
}
}
implements ThreadStartEvent {
}
return "ThreadStartEvent";
}
}
implements VMStartEvent {
}
return "VMStartEvent";
}
}
}
return "VMDeathEvent";
}
}
implements VMDisconnectEvent {
}
return "VMDisconnectEvent";
}
}
implements WatchpointEvent {
private final long fieldID;
int requestID,
}
}
return field;
}
return object;
}
} else {
}
}
}
implements AccessWatchpointEvent {
}
return "AccessWatchpoint";
}
}
implements ModificationWatchpointEvent {
}
return newValue;
}
return "ModificationWatchpoint";
}
}
/**
* Events are constructed on the thread which reads all data from the
* transport. This means that the packet cannot be converted to real
* JDI objects as that may involve further communications with the
* back end which would deadlock.
*
* Hence the {@link #build()} method below called by EventQueue.
*/
super();
// From "MirrorImpl":
// Yes, its a bit of a hack. But by doing it this
// way, this is the only place we have to change
// typing to substitute a new impl.
}
/**
* Constructor for special events like VM disconnected
*/
switch (eventCmd) {
addEvent(new VMDisconnectEventImpl());
break;
default:
throw new InternalException("Bad singleton event code");
}
}
// Note that this class has a public add method that throws
// an exception so that clients can't modify the EventSet
}
/*
* Complete the construction of an EventSet. This is called from
* an event handler thread. It upacks the JDWP events inside
* the packet and creates EventImpls for them. The EventSet is already
* on EventQueues when this is called, so it has to be synch.
*/
synchronized void build() {
return;
}
switch(suspendPolicy) {
break;
break;
break;
}
}
try {
} catch (VMDisconnectedException ee) {
// ignore - see bug 6502716
}
}
switch (evt.destination()) {
case UNKNOWN_EVENT:
// Ignore disabled, deleted, unknown events, but
// save the thread if there is one since we might
// have to resume it. Note that events for different
// threads can't be in the same event set.
if (evt instanceof ThreadedEventImpl &&
}
continue;
case CLIENT_EVENT:
break;
case INTERNAL_EVENT:
if (internalEventSet == null) {
}
break;
default:
throw new InternalException("Invalid event destination");
}
}
// Avoid hangs described in 6296125, 6293795
if (super.size() == 0) {
// This set has no client events. If we don't do
// needed resumes, no one else is going to.
// See bug 6485605.
if (fix6485605 != null) {
fix6485605.resume();
} else {
// apparently, there is nothing to resume.
}
}
}
}
/**
* Filter out internal events
*/
return this;
}
/**
* Filter out user events.
*/
return this.internalEventSet;
}
return new ThreadStartEventImpl(
return new ThreadDeathEventImpl(
return new ExceptionEventImpl(
return new BreakpointEventImpl(
return new MethodEntryEventImpl(
return new MethodExitEventImpl(
return new MethodExitEventImpl(
return new AccessWatchpointEventImpl(
return new ModificationWatchpointEventImpl(
return new StepEventImpl(
return new ClassPrepareEventImpl(
return new ClassUnloadEventImpl(
return new MonitorContendedEnterEventImpl(
return new MonitorContendedEnteredEventImpl(
return new MonitorWaitEventImpl(
return new MonitorWaitedEventImpl(
return new VMStartEventImpl(
return new VMDeathEventImpl(
default:
// Ignore unknown event types
return null;
}
}
return vm;
}
public int suspendPolicy() {
}
if (event instanceof ThreadedEventImpl) {
}
}
return null;
}
public void resume() {
switch (suspendPolicy()) {
case EventRequest.SUSPEND_ALL:
break;
throw new InternalException("Inconsistent suspend policy");
}
break;
case EventRequest.SUSPEND_NONE:
// Do nothing
break;
default:
throw new InternalException("Invalid suspend policy");
}
}
return new Itr();
}
return new Itr();
}
/**
* Index of element to be returned by subsequent call to next.
*/
public boolean hasNext() {
}
try {
++cursor;
return nxt;
} catch(IndexOutOfBoundsException e) {
throw new NoSuchElementException();
}
}
return next();
}
public void remove() {
throw new UnsupportedOperationException();
}
}
/* below make this unmodifiable */
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}
throw new UnsupportedOperationException();
}
public void clear() {
throw new UnsupportedOperationException();
}
}