mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-CR-10382 fixes
This commit is contained in:
+6
-2
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.remoteServer.agent.impl;
|
||||
|
||||
import com.intellij.util.concurrency.SequentialTaskExecutor;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.reflect.Proxy;
|
||||
@@ -38,7 +39,10 @@ public class RemoteAgentThreadProxyCreator {
|
||||
|
||||
return agentInterface.cast(Proxy.newProxyInstance(callerClassLoader,
|
||||
new Class[]{agentInterface},
|
||||
new ThreadInvocationHandler(callerClassLoader, agentInstance,
|
||||
myPreWrapperCreator)));
|
||||
new ThreadInvocationHandler(
|
||||
SequentialTaskExecutor.createSequentialApplicationPoolExecutor(),
|
||||
callerClassLoader, agentInstance,
|
||||
myPreWrapperCreator
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
+12
-8
@@ -41,9 +41,9 @@ public class ThreadInvocationHandler implements InvocationHandler {
|
||||
private final Object myTarget;
|
||||
private final ChildWrapperCreator myPreWrapperFactory;
|
||||
|
||||
public ThreadInvocationHandler(ClassLoader callerClassLoader, Object target,
|
||||
public ThreadInvocationHandler(ExecutorService taskExecutor, ClassLoader callerClassLoader, Object target,
|
||||
@Nullable ChildWrapperCreator preWrapperCreator) {
|
||||
myTaskExecutor = com.intellij.util.concurrency.SequentialTaskExecutor.createSequentialApplicationPoolExecutor();
|
||||
myTaskExecutor = taskExecutor;
|
||||
myCallerClassLoader = callerClassLoader;
|
||||
myTarget = target;
|
||||
myPreWrapperFactory = preWrapperCreator;
|
||||
@@ -74,7 +74,7 @@ public class ThreadInvocationHandler implements InvocationHandler {
|
||||
|
||||
boolean childCall = method.getAnnotation(ChildCall.class) != null;
|
||||
if (childCall) {
|
||||
Object child = immediateCall ? taskCallable.call() : execute(taskCallable);
|
||||
Object child = immediateCall ? taskCallable.call() : executeAndWait(taskCallable);
|
||||
if (child == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public class ThreadInvocationHandler implements InvocationHandler {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return execute(taskCallable);
|
||||
return executeAndWait(taskCallable);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@@ -129,8 +129,9 @@ public class ThreadInvocationHandler implements InvocationHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private Object execute(Callable<Object> taskCallable) throws Throwable {
|
||||
Object child;Future<Object> future = myTaskExecutor.submit(taskCallable);
|
||||
private Object executeAndWait(Callable<Object> taskCallable) throws Throwable {
|
||||
Object child;
|
||||
Future<Object> future = myTaskExecutor.submit(taskCallable);
|
||||
try {
|
||||
child = future.get();
|
||||
}
|
||||
@@ -168,7 +169,10 @@ public class ThreadInvocationHandler implements InvocationHandler {
|
||||
|
||||
return Proxy.newProxyInstance(myCallerClassLoader,
|
||||
new Class[]{callerChildInterface},
|
||||
new ThreadInvocationHandler(myCallerClassLoader, preWrappedChild,
|
||||
myPreWrapperFactory));
|
||||
new ThreadInvocationHandler(
|
||||
myTaskExecutor,
|
||||
myCallerClassLoader, preWrappedChild,
|
||||
myPreWrapperFactory
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user