Python console: a try with commons xmlrpc transport instead of default one, which hangs on getting inputStream.

This commit is contained in:
Dmitry Trofimov
2011-02-22 11:13:32 +03:00
parent b7976c8607
commit 09afbde223
2 changed files with 7 additions and 13 deletions
@@ -3,6 +3,7 @@ package com.jetbrains.python.console.pydev;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.net.NetUtils;
import org.apache.xmlrpc.AsyncCallback;
import org.apache.xmlrpc.CommonsXmlRpcTransportFactory;
import org.apache.xmlrpc.XmlRpcClient;
import org.apache.xmlrpc.XmlRpcException;
@@ -44,7 +45,7 @@ public class PydevXmlRpcClient implements IPydevXmlRpcClient {
*/
private static final Logger LOG = Logger.getInstance(PydevXmlRpcClient.class.getName());
private static final long TIME_LIMIT = 30000;
private static final long TIME_LIMIT = 60000;
/**
@@ -52,7 +53,11 @@ public class PydevXmlRpcClient implements IPydevXmlRpcClient {
*/
public PydevXmlRpcClient(Process process, ThreadStreamReader stdErrReader, ThreadStreamReader stdOutReader, int port)
throws MalformedURLException {
this.impl = new XmlRpcClient(NetUtils.getLocalHostString(), port);
String hostname = NetUtils.getLocalHostString();
URL url = new URL("http://" + hostname + ':' + port + "/RPC2");
this.impl = new XmlRpcClient(url, new CommonsXmlRpcTransportFactory(url));
this.process = process;
this.stdErrReader = stdErrReader;
this.stdOutReader = stdOutReader;
@@ -24,8 +24,6 @@ import com.jetbrains.django.run.Runner;
import com.jetbrains.python.PythonHelpersLocator;
import com.jetbrains.python.console.pydev.ConsoleCommunication;
import com.jetbrains.python.console.pydev.PydevConsoleCommunication;
import com.jetbrains.python.sdk.JythonSdkFlavor;
import com.jetbrains.python.sdk.PythonSdkFlavor;
import org.apache.xmlrpc.XmlRpcException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -140,15 +138,6 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory {
final LanguageConsoleImpl console = getConsoleView().getConsole();
//TODO: it is a dirty hack, implement proper handshake for processes
if (PythonSdkFlavor.getFlavor(mySdk.getHomePath()) instanceof JythonSdkFlavor) {
try {
Thread.sleep(3000);
}
catch (InterruptedException e) {
}
}
if (handshake()) {
// Make executed statements visible to developers
PyConsoleHighlightingUtil.processOutput(console, PYTHON_ENV_COMMAND, ProcessOutputTypes.SYSTEM);