Skip to content

Commit

Permalink
refact: replace this lambda with method reference 'h::destroyForcibly'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Jul 10, 2024
1 parent c79120d commit bf6cddc
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public DSPProcess(DSPDebugTarget dspDebugTarget, ProcessEventArguments args) {
this.target = dspDebugTarget;
this.proxy = new DSPStreamsProxy(target.getDebugProtocolServer());
this.processArgs = args;
handle = args != null && args.getSystemProcessId() != null ? ProcessHandle.of(args.getSystemProcessId()) : Optional.empty();
handle = args != null && args.getSystemProcessId() != null ? ProcessHandle.of(args.getSystemProcessId())
: Optional.empty();
}

@Override
Expand All @@ -68,7 +69,7 @@ public void terminate() throws DebugException {
terminated = true;
handle.ifPresent(h -> {
h.destroy(); // normal termination
CompletableFuture.runAsync(() -> h.destroyForcibly(), CompletableFuture.delayedExecutor(5, TimeUnit.SECONDS)); // forced termination if normal is not sufficient
CompletableFuture.runAsync(h::destroyForcibly, CompletableFuture.delayedExecutor(5, TimeUnit.SECONDS)); // forced termination if normal is not sufficient
});
DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { new DebugEvent(this, DebugEvent.TERMINATE) });
target.terminate();
Expand Down

0 comments on commit bf6cddc

Please sign in to comment.