@Override public void setSuspendPolicy(int policy) { super.setSuspendPolicy(policy); if (startRequest != null) { boolean enabled = startRequest.isEnabled(); startRequest.setEnabled(false); applySuspendPolicy(startRequest); startRequest.setEnabled(enabled); } if (deathRequest != null) { boolean enabled = deathRequest.isEnabled(); deathRequest.setEnabled(false); applySuspendPolicy(deathRequest); deathRequest.setEnabled(enabled); } }
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException(new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
@Override protected void deleteRequests() { // Delete the old requests, if any. try { if (startRequest != null) { VirtualMachine vm = startRequest.virtualMachine(); EventRequestManager erm = vm.eventRequestManager(); erm.deleteEventRequest(startRequest); } if (deathRequest != null) { VirtualMachine vm = deathRequest.virtualMachine(); EventRequestManager erm = vm.eventRequestManager(); erm.deleteEventRequest(deathRequest); } } catch (VMDisconnectedException vmde) { // This happens all the time. } finally { startRequest = null; deathRequest = null; } }