Proposed KiwiEnvironment enhancements #685
Replies: 4 comments 1 reply
-
Added |
Beta Was this translation helpful? Give feedback.
-
Another possible method is to get a public static Optional<ProcessHandle> of(long pid) We could add a similar method to Optional<ProcessHandle> procesHandleOfPid(long pid) |
Beta Was this translation helpful? Give feedback.
-
I created a bit of sample code to see whether the Sonar warning about package org.kiwiproject.util;
import org.kiwiproject.base.KiwiEnvironment;
public class CurrentThreadSample {
private KiwiEnvironment env;
public CurrentThreadSample(KiwiEnvironment env) {
this.env = env;
}
void callsMethodThatMightBeInterrupted() {
try {
methodThatMightBeInterrupted();
} catch (InterruptedException e) {
env.interruptCurrentThread(); // the Sonar warning still occurs if use only this method
env.currentThread().interrupt(); // the Sonar warning goes away if use this method
}
}
void methodThatMightBeInterrupted() throws InterruptedException {
Thread.sleep(42);
}
} Since the Sonar warning still occurs if you use But, since the Sonar warning disappears when using |
Beta Was this translation helpful? Give feedback.
-
Added the following issues: Note that Along with the previous completion of #919 ( |
Beta Was this translation helpful? Give feedback.
-
Some proposed methods:
currentThread()
interruptCurrentThread()
currentProcess()
Considerations:
Beta Was this translation helpful? Give feedback.
All reactions