/*
* 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.
*/
/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
* required for a production-quality application, such as security checks,
* input validation and proper error handling, might not be present in
* this sample code.
*/
volatile boolean connected = true;
boolean completed = false;
boolean stopOnVMStart;
this.stopOnVMStart = stopOnVMStart;
}
synchronized void shutdown() {
connected = false; // force run() loop termination
while (!completed) {
}
}
public void run() {
while (connected) {
try {
boolean resumeStoppedApp = false;
}
if (resumeStoppedApp) {
}
} catch (InterruptedException exc) {
// Do nothing. Any changes will be seen at top of loop.
} catch (VMDisconnectedException discExc) {
break;
}
}
synchronized (this) {
completed = true;
notifyAll();
}
}
if (event instanceof ExceptionEvent) {
return exceptionEvent(event);
} else if (event instanceof BreakpointEvent) {
return breakpointEvent(event);
} else if (event instanceof WatchpointEvent) {
return fieldWatchEvent(event);
} else if (event instanceof MethodEntryEvent) {
return methodEntryEvent(event);
} else if (event instanceof MethodExitEvent) {
return methodExitEvent(event);
} else if (event instanceof ClassPrepareEvent) {
return classPrepareEvent(event);
} else if (event instanceof ClassUnloadEvent) {
return classUnloadEvent(event);
} else if (event instanceof ThreadStartEvent) {
return threadStartEvent(event);
} else if (event instanceof ThreadDeathEvent) {
return threadDeathEvent(event);
} else if (event instanceof VMStartEvent) {
return vmStartEvent(event);
} else {
return handleExitEvent(event);
}
}
private boolean vmDied = false;
if (event instanceof VMDeathEvent) {
vmDied = true;
return vmDeathEvent(event);
} else if (event instanceof VMDisconnectEvent) {
connected = false;
if (!vmDied) {
}
return false;
} else {
}
}
synchronized void handleDisconnectedException() {
/*
* A VMDisconnectedException has happened while dealing with
* another event. We need to flush the event queue, dealing only
* with exit events (VMDeath, VMDisconnect) so that we terminate
* correctly.
*/
while (connected) {
try {
}
} catch (InterruptedException exc) {
// ignore
} catch (InternalError exc) {
// ignore
}
}
}
if (event instanceof ClassPrepareEvent) {
} else if (event instanceof LocatableEvent) {
} else if (event instanceof ThreadStartEvent) {
} else if (event instanceof ThreadDeathEvent) {
} else if (event instanceof VMStartEvent) {
} else {
return null;
}
}
/*
* If any event in the set has a thread associated with it,
* they all will, so just grab the first one.
*/
} else {
}
}
}
return stopOnVMStart;
}
return true;
}
return true;
}
}
return true;
}
return true;
}
return true;
} else {
return false;
}
}
return false;
}
return true;
}
return false;
}
return false;
}
shutdownMessageKey = "The application exited";
return false;
}
shutdownMessageKey = "The application has been disconnected";
return false;
}
}