code: public static void detectJdiExitEvent(VirtualMachine vm, Consumer<String> unbiddenExitHandler) {
          if (vm.canBeModified()) {
              new JdiEventHandler(vm, unbiddenExitHandler).start();
          }
      }
docs: Monitor the JDI event stream for {@link com.sun.jdi.event.VMDeathEvent}
  and {@link com.sun.jdi.event.VMDisconnectEvent}. If encountered, invokes
  {@code unbiddenExitHandler}.
  
  @param vm the virtual machine to check
  @param unbiddenExitHandler the handler, which will accept the exit
  information