keeping JMX connection open and react to connection lost event + integrating remote apps into the regular connect/disconnect command handling
This commit is contained in:
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
@@ -94,8 +95,14 @@ public class LiveProcessCommandElement extends QuickAccessElement {
|
||||
|
||||
commandParams.setArguments(arguments);
|
||||
|
||||
CompletableFuture.allOf(usedLanguageServers.stream().map(ls ->
|
||||
ls.getWorkspaceService().executeCommand(commandParams)).toArray(CompletableFuture[]::new)).join();
|
||||
try {
|
||||
CompletableFuture.allOf(usedLanguageServers.stream().map(ls ->
|
||||
ls.getWorkspaceService().executeCommand(commandParams)).toArray(CompletableFuture[]::new)).get(2, TimeUnit.SECONDS);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// TODO: better exception handling
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
@@ -59,9 +60,16 @@ public class LiveProcessCommandsQuickAccessProvider implements IQuickAccessCompu
|
||||
commandParams.setCommand(LiveProcessCommandElement.COMMAND_LIST_PROCESSES);
|
||||
|
||||
List<QuickAccessElement> res = Collections.synchronizedList(new ArrayList<>());
|
||||
CompletableFuture.allOf(usedLanguageServers.stream().map(ls ->
|
||||
ls.getWorkspaceService().executeCommand(commandParams).thenAcceptAsync(commandResult ->
|
||||
createCommandItems(res, commandResult))).toArray(CompletableFuture[]::new)).join();
|
||||
|
||||
try {
|
||||
CompletableFuture.allOf(usedLanguageServers.stream().map(ls ->
|
||||
ls.getWorkspaceService().executeCommand(commandParams).thenAcceptAsync(commandResult ->
|
||||
createCommandItems(res, commandResult))).toArray(CompletableFuture[]::new)).get(2000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// TODO: better error handling
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return res.toArray(new QuickAccessElement[res.size()]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user