public class PythonClient extends CallbackClient
Subclass of CallbackClient that implements the new threading model, ensuring that each thread uses its own connection.
Modifier and Type | Field and Description |
---|---|
protected java.util.logging.Logger |
logger |
address, connections, DEFAULT_ADDRESS, DEFAULT_MIN_CONNECTION_TIME, minConnectionTime, minConnectionTimeUnit, port, socketFactory
Constructor and Description |
---|
PythonClient(Gateway gateway,
java.util.List<java.lang.Class<? extends Command>> customCommands,
int pythonPort,
java.net.InetAddress pythonAddress,
long minConnectionTime,
java.util.concurrent.TimeUnit minConnectionTimeUnit,
javax.net.SocketFactory socketFactory,
Py4JJavaServer javaServer) |
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
CallbackClient.minConnectionTime
and the CallbackClient.socketFactory . |
protected Py4JClientConnection |
getConnection() |
Gateway |
getGateway() |
Py4JJavaServer |
getJavaServer() |
protected void |
giveBackConnection(Py4JClientConnection cc) |
void |
setGateway(Gateway gateway) |
void |
setJavaServer(Py4JJavaServer javaServer) |
protected void |
setupCleaner() |
protected boolean |
shouldRetrySendCommand(Py4JClientConnection cc,
Py4JException pe) |
getAddress, getConnectionLock, getPort, periodicCleanup, sendCommand, sendCommand, shutdown
public PythonClient(Gateway gateway, java.util.List<java.lang.Class<? extends Command>> customCommands, int pythonPort, java.net.InetAddress pythonAddress, long minConnectionTime, java.util.concurrent.TimeUnit minConnectionTimeUnit, javax.net.SocketFactory socketFactory, Py4JJavaServer javaServer)
public Gateway getGateway()
public void setGateway(Gateway gateway)
public Py4JJavaServer getJavaServer()
public void setJavaServer(Py4JJavaServer javaServer)
protected void setupCleaner()
setupCleaner
in class CallbackClient
protected Py4JClientConnection getConnection() throws java.io.IOException
getConnection
in class CallbackClient
java.io.IOException
protected boolean shouldRetrySendCommand(Py4JClientConnection cc, Py4JException pe)
shouldRetrySendCommand
in class CallbackClient
protected void giveBackConnection(Py4JClientConnection cc)
giveBackConnection
in class CallbackClient
public Py4JPythonClient copyWith(java.net.InetAddress pythonAddress, int pythonPort)
CallbackClient
Creates a callback client which connects to the given address and port,
but retains all the other settings (like the CallbackClient.minConnectionTime
and the CallbackClient.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.
copyWith
in interface Py4JPythonClient
copyWith
in class CallbackClient
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.