mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-18029 Rename Python Console Thrift services
* Rename `PythonConsole` to `PythonConsoleBackendService`. * Rename `IDE` to `PythonConsoleFrontendService`.
This commit is contained in:
@@ -106,7 +106,7 @@ typedef string AttributeDescription
|
||||
|
||||
typedef list<DebugValue> DebugValues
|
||||
|
||||
service PythonConsole {
|
||||
service PythonConsoleBackendService {
|
||||
/**
|
||||
* Returns `true` if Python console script needs more code to evaluate it.
|
||||
* Returns `false` if the code is scheduled for evaluation.
|
||||
@@ -160,12 +160,12 @@ service PythonConsole {
|
||||
GetArrayResponse getArray(1: string vars, 2: i32 rowOffset, 3: i32 colOffset, 4: i32 rows, 5: i32 cols, 6: string format),
|
||||
|
||||
/**
|
||||
* The result is returned asyncronously with `IDE.returnFullValue`.
|
||||
* The result is returned asyncronously with `PythonConsoleFrontendService.returnFullValue`.
|
||||
*/
|
||||
void loadFullValue(1: LoadFullValueRequestSeq seq, 2: list<string> variables),
|
||||
}
|
||||
|
||||
service IDE {
|
||||
service PythonConsoleFrontendService {
|
||||
void notifyFinished(1: bool needsMoreInput),
|
||||
|
||||
string requestInput(1: string path),
|
||||
@@ -175,7 +175,7 @@ service IDE {
|
||||
void showConsole(),
|
||||
|
||||
/**
|
||||
* Returns the result for `PythonConsole.loadFullValue`.
|
||||
* Returns the result for `PythonConsoleBackendService.loadFullValue`.
|
||||
*/
|
||||
void returnFullValue(1: LoadFullValueRequestSeq requestSeq, 2: list<DebugValue> response),
|
||||
|
||||
|
||||
@@ -282,8 +282,8 @@ def start_server(port):
|
||||
|
||||
enable_thrift_logging()
|
||||
|
||||
server_service = console_thrift.PythonConsole
|
||||
client_service = console_thrift.IDE
|
||||
server_service = console_thrift.PythonConsoleBackendService
|
||||
client_service = console_thrift.PythonConsoleFrontendService
|
||||
|
||||
# 1. Start Python console server
|
||||
|
||||
@@ -315,7 +315,7 @@ def start_client(host, port):
|
||||
|
||||
enable_thrift_logging()
|
||||
|
||||
client_service = console_thrift.IDE
|
||||
client_service = console_thrift.PythonConsoleFrontendService
|
||||
|
||||
client, server_transport = make_rpc_client(client_service, host, port)
|
||||
|
||||
@@ -328,7 +328,7 @@ def start_client(host, port):
|
||||
# # Tell UMD the proper default namespace
|
||||
# _set_globals_function(interpreter.get_namespace)
|
||||
|
||||
server_service = console_thrift.PythonConsole
|
||||
server_service = console_thrift.PythonConsoleBackendService
|
||||
|
||||
# `InterpreterInterface` implements all methods required for the handler
|
||||
server_handler = interpreter
|
||||
|
||||
+3
-3
@@ -7,8 +7,8 @@
|
||||
package com.jetbrains.python.console;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.11.0)", date = "2018-07-02")
|
||||
public class PythonConsole {
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.11.0)", date = "2018-07-09")
|
||||
public class PythonConsoleBackendService {
|
||||
|
||||
public interface Iface {
|
||||
|
||||
@@ -77,7 +77,7 @@ public class PythonConsole {
|
||||
public GetArrayResponse getArray(java.lang.String vars, int rowOffset, int colOffset, int rows, int cols, java.lang.String format) throws org.apache.thrift.TException;
|
||||
|
||||
/**
|
||||
* The result is returned asyncronously with `IDE.returnFullValue`.
|
||||
* The result is returned asyncronously with `PythonConsoleFrontendService.returnFullValue`.
|
||||
*
|
||||
* @param seq
|
||||
* @param variables
|
||||
+3
-3
@@ -7,8 +7,8 @@
|
||||
package com.jetbrains.python.console;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.11.0)", date = "2018-05-18")
|
||||
public class IDE {
|
||||
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.11.0)", date = "2018-07-09")
|
||||
public class PythonConsoleFrontendService {
|
||||
|
||||
public interface Iface {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class IDE {
|
||||
public void showConsole() throws org.apache.thrift.TException;
|
||||
|
||||
/**
|
||||
* Returns the result for `PythonConsole.loadFullValue`.
|
||||
* Returns the result for `PythonConsoleBackendService.loadFullValue`.
|
||||
*
|
||||
* @param requestSeq
|
||||
* @param response
|
||||
@@ -59,7 +59,7 @@ public class PydevConsoleCommunication extends AbstractConsoleCommunication impl
|
||||
/**
|
||||
* Thrift RPC client for sending messages to the server.
|
||||
*/
|
||||
private PythonConsole.Iface myClient;
|
||||
private PythonConsoleBackendService.Iface myClient;
|
||||
|
||||
/**
|
||||
* This is the server responsible for giving input to a raw_input() requested.
|
||||
@@ -107,8 +107,9 @@ public class PydevConsoleCommunication extends AbstractConsoleCommunication impl
|
||||
}
|
||||
|
||||
public void startServer(int port) throws InterruptedException {
|
||||
IDEHandler serverHandler = new IDEHandler();
|
||||
IDE.Processor<IDE.Iface> serverProcessor = new IDE.Processor<>(serverHandler);
|
||||
PythonConsoleFrontendHandler serverHandler = new PythonConsoleFrontendHandler();
|
||||
PythonConsoleFrontendService.Processor<PythonConsoleFrontendService.Iface> serverProcessor =
|
||||
new PythonConsoleFrontendService.Processor<>(serverHandler);
|
||||
//noinspection IOResourceOpenedButNotSafelyClosed
|
||||
TNettyServerTransport serverTransport = new TNettyServerTransport(port);
|
||||
TThreadPoolServer server = new TThreadPoolServer(
|
||||
@@ -120,7 +121,7 @@ public class PydevConsoleCommunication extends AbstractConsoleCommunication impl
|
||||
ApplicationManager.getApplication().executeOnPooledThread(() -> {
|
||||
TTransport clientTransport = serverTransport.getReverseTransport();
|
||||
TBinaryProtocol clientProtocol = new TBinaryProtocol(clientTransport);
|
||||
PythonConsole.Client client = new PythonConsole.Client(clientProtocol);
|
||||
PythonConsoleBackendService.Client client = new PythonConsoleBackendService.Client(clientProtocol);
|
||||
|
||||
this.myServer = server;
|
||||
this.myClient = PythonConsoleClientUtil.synchronizedPythonConsoleClient(PydevConsoleCommunication.class.getClassLoader(), client);
|
||||
@@ -144,12 +145,13 @@ public class PydevConsoleCommunication extends AbstractConsoleCommunication impl
|
||||
clientTransport.open();
|
||||
|
||||
TBinaryProtocol clientProtocol = new TBinaryProtocol(clientTransport);
|
||||
PythonConsole.Client client = new PythonConsole.Client(clientProtocol);
|
||||
PythonConsoleBackendService.Client client = new PythonConsoleBackendService.Client(clientProtocol);
|
||||
|
||||
TServerTransport serverTransport = clientTransport.getServerTransport();
|
||||
|
||||
IDEHandler serverHandler = new IDEHandler();
|
||||
IDE.Processor<IDE.Iface> serverProcessor = new IDE.Processor<>(serverHandler);
|
||||
PythonConsoleFrontendHandler serverHandler = new PythonConsoleFrontendHandler();
|
||||
PythonConsoleFrontendService.Processor<PythonConsoleFrontendService.Iface> serverProcessor =
|
||||
new PythonConsoleFrontendService.Processor<>(serverHandler);
|
||||
|
||||
TThreadPoolServer server = new TThreadPoolServer(
|
||||
new TThreadPoolServer.Args(serverTransport).processor(serverProcessor).protocolFactory(new TBinaryProtocol.Factory())
|
||||
@@ -732,7 +734,7 @@ public class PydevConsoleCommunication extends AbstractConsoleCommunication impl
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
|
||||
private class IDEHandler implements IDE.Iface {
|
||||
private class PythonConsoleFrontendHandler implements PythonConsoleFrontendService.Iface {
|
||||
|
||||
@Override
|
||||
public void notifyFinished(boolean needsMoreInput) {
|
||||
|
||||
@@ -13,10 +13,10 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
@JvmOverloads
|
||||
fun synchronizedPythonConsoleClient(loader: ClassLoader,
|
||||
delegate: PythonConsole.Iface,
|
||||
pythonConsoleProcess: Process? = null): PythonConsole.Iface {
|
||||
delegate: PythonConsoleBackendService.Iface,
|
||||
pythonConsoleProcess: Process? = null): PythonConsoleBackendService.Iface {
|
||||
val lock = ReentrantLock()
|
||||
return Proxy.newProxyInstance(loader, arrayOf<Class<*>>(PythonConsole.Iface::class.java),
|
||||
return Proxy.newProxyInstance(loader, arrayOf<Class<*>>(PythonConsoleBackendService.Iface::class.java),
|
||||
InvocationHandler { _, method, args ->
|
||||
val future = ApplicationManager.getApplication().executeOnPooledThread(Callable<Any> {
|
||||
lock.lock()
|
||||
@@ -49,5 +49,5 @@ fun synchronizedPythonConsoleClient(loader: ClassLoader,
|
||||
}
|
||||
}
|
||||
}
|
||||
}) as PythonConsole.Iface
|
||||
}) as PythonConsoleBackendService.Iface
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user