mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed deadlock in Ruby Remote SDK configuration
RubySdkLoadPathInitializer shouldn't block forever, especially when it's under inspection with ReadLock. now it executed with #checkCancelled. RUBY-23085 RM hangs after add new docker-compose sdk in the settings [IDEA-CR-40458]
This commit is contained in:
@@ -62,6 +62,23 @@ public class ApplicationUtil {
|
||||
}
|
||||
}, indicator));
|
||||
|
||||
try {
|
||||
runWithCheckCanceled(future, indicator);
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
future.cancel(true);
|
||||
throw e;
|
||||
}
|
||||
return result.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for {@code future} to be complete, or the current thread's indicator to be canceled
|
||||
* Note that {@code future} will not be cancelled by this method
|
||||
*/
|
||||
public static void runWithCheckCanceled(@NotNull Future<?> future, @NotNull final ProgressIndicator indicator) throws Exception {
|
||||
final Ref<Throwable> error = Ref.create();
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
indicator.checkCanceled();
|
||||
@@ -74,7 +91,7 @@ public class ApplicationUtil {
|
||||
try {
|
||||
future.get(25, TimeUnit.MILLISECONDS);
|
||||
ExceptionUtil.rethrowAll(error.get());
|
||||
return result.get();
|
||||
break;
|
||||
}
|
||||
catch (TimeoutException ignored) { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user