public interface Py4JPythonClient
Interface that describes the operations a client must support to make requests to the Python side.
Modifier and Type | Method and Description |
---|---|
Py4JPythonClient |
copyWith(java.net.InetAddress pythonAddress,
int pythonPort)
Creates a callback client which connects to the given address and port,
but retains all the other settings (like the minConnectionTime
and the socketFactory).
|
java.net.InetAddress |
getAddress() |
int |
getPort() |
java.lang.Object |
getPythonServerEntryPoint(Gateway gateway,
java.lang.Class[] interfacesToImplement)
Gets a reference to the entry point on the Python side.
|
int |
getReadTimeout() |
boolean |
isMemoryManagementEnabled() |
java.lang.String |
sendCommand(java.lang.String command)
Sends a command to the Python side.
|
java.lang.String |
sendCommand(java.lang.String command,
boolean blocking)
Sends a command to the Python side.
|
void |
shutdown()
Closes all active channels, stops the periodic cleanup of channels and
mark the client as shutting down.
|
java.lang.String sendCommand(java.lang.String command)
Sends a command to the Python side. This method is typically used by Python proxies to call Python methods or to request the garbage collection of a proxy.
command
- The command to send.java.lang.String sendCommand(java.lang.String command, boolean blocking)
Sends a command to the Python side. This method is typically used by Python proxies to call Python methods or to request the garbage collection of a proxy.
command
- The command to send.blocking
- If the CallbackClient should wait for an answer (default
should be True, except for critical cases such as a
finalizer sending a command).void shutdown()
Closes all active channels, stops the periodic cleanup of channels and mark the client as shutting down. No more commands can be sent after this method has been called, except commands that were initiated before the shutdown method was called..
Py4JPythonClient copyWith(java.net.InetAddress pythonAddress, int pythonPort)
Creates a callback client which connects to the given address and port, but retains all the other settings (like the minConnectionTime and the socketFactory). This method is useful if for some reason your CallbackServer changes its address or you come to know of the address after Gateway has already instantiated.
pythonAddress
- The address used by a PythonProxyHandler to connect to a
Python gateway.pythonPort
- The port used by a PythonProxyHandler to connect to a Python
gateway. Essentially the port used for Python callbacks.boolean isMemoryManagementEnabled()
int getPort()
int getReadTimeout()
java.net.InetAddress getAddress()
java.lang.Object getPythonServerEntryPoint(Gateway gateway, java.lang.Class[] interfacesToImplement)
Gets a reference to the entry point on the Python side. This is often necessary if Java is driving the communication because Java cannot call static methods, initialize Python objects or load Python modules yet.
gateway
- interfacesToImplement
-