mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-15 06:49:56 +00:00
aftermath to 6ef57221e3: avoiding NPE when waiting for listener thread
This commit is contained in:
1 parent
475db734e4
commit
63bbfb1a9f
1 file changed
+5
-4
+5
-4
@@ -200,13 +200,14 @@ public class MarkPassingCalculator {
|
||||
*/
|
||||
public void waitUntilStopped(final long timeoutInMillis) throws InterruptedException {
|
||||
final long start = System.currentTimeMillis();
|
||||
if (listenerThread != null) {
|
||||
synchronized (listenerThread) {
|
||||
final Thread theListenerThread = listenerThread;
|
||||
if (theListenerThread != null) {
|
||||
synchronized (theListenerThread) {
|
||||
while (!listenerThreadStarted && System.currentTimeMillis() - start < timeoutInMillis) {
|
||||
listenerThread.wait(timeoutInMillis);
|
||||
theListenerThread.wait(timeoutInMillis);
|
||||
}
|
||||
}
|
||||
listenerThread.join(timeoutInMillis);
|
||||
theListenerThread.join(timeoutInMillis);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user