public class ClientServerConnection extends java.lang.Object implements Py4JServerConnection, Py4JClientConnection, java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
protected AuthCommand |
authCommand |
protected java.lang.String |
authToken |
protected int |
blockingReadTimeout |
protected java.util.Map<java.lang.String,Command> |
commands |
protected Py4JJavaServer |
javaServer |
protected java.util.logging.Logger |
logger |
protected int |
nonBlockingReadTimeout |
protected Py4JPythonClientPerThread |
pythonClient |
protected java.io.BufferedReader |
reader |
protected java.net.Socket |
socket |
protected java.io.BufferedWriter |
writer |
Constructor and Description |
---|
ClientServerConnection(Gateway gateway,
java.net.Socket socket,
java.util.List<java.lang.Class<? extends Command>> customCommands,
Py4JPythonClientPerThread pythonClient,
Py4JJavaServer javaServer,
int readTimeout) |
ClientServerConnection(Gateway gateway,
java.net.Socket socket,
java.util.List<java.lang.Class<? extends Command>> customCommands,
Py4JPythonClientPerThread pythonClient,
Py4JJavaServer javaServer,
int readTimeout,
java.lang.String authToken) |
Modifier and Type | Method and Description |
---|---|
protected void |
fireConnectionStopped() |
java.net.Socket |
getSocket() |
protected void |
initCommands(Gateway gateway,
java.util.List<java.lang.Class<? extends Command>> commandsClazz)
Override this method to initialize custom commands.
|
boolean |
isInitiatedFromClient() |
protected void |
quietSendFatalError(java.io.BufferedWriter writer,
java.lang.Throwable exception) |
protected java.lang.String |
readBlockingResponse(java.io.BufferedReader reader) |
protected java.lang.String |
readNonBlockingResponse(java.net.Socket socket,
java.io.BufferedReader reader) |
void |
run() |
java.lang.String |
sendCommand(java.lang.String command) |
java.lang.String |
sendCommand(java.lang.String command,
boolean blocking) |
void |
setInitiatedFromClient(boolean initiatedFromClient) |
void |
setUsed(boolean used) |
void |
shutdown() |
void |
shutdown(boolean reset) |
void |
start() |
void |
startServerConnection() |
void |
waitForCommands() |
boolean |
wasUsed() |
protected java.net.Socket socket
protected java.io.BufferedWriter writer
protected java.io.BufferedReader reader
protected final java.util.Map<java.lang.String,Command> commands
protected final java.util.logging.Logger logger
protected final Py4JJavaServer javaServer
protected final Py4JPythonClientPerThread pythonClient
protected final int blockingReadTimeout
protected final int nonBlockingReadTimeout
protected final java.lang.String authToken
protected final AuthCommand authCommand
public ClientServerConnection(Gateway gateway, java.net.Socket socket, java.util.List<java.lang.Class<? extends Command>> customCommands, Py4JPythonClientPerThread pythonClient, Py4JJavaServer javaServer, int readTimeout) throws java.io.IOException
java.io.IOException
public ClientServerConnection(Gateway gateway, java.net.Socket socket, java.util.List<java.lang.Class<? extends Command>> customCommands, Py4JPythonClientPerThread pythonClient, Py4JJavaServer javaServer, int readTimeout, java.lang.String authToken) throws java.io.IOException
java.io.IOException
public void startServerConnection() throws java.io.IOException
java.io.IOException
public void run()
run
in interface java.lang.Runnable
protected void initCommands(Gateway gateway, java.util.List<java.lang.Class<? extends Command>> commandsClazz)
Override this method to initialize custom commands.
gateway
- commandsClazz
- protected void fireConnectionStopped()
protected void quietSendFatalError(java.io.BufferedWriter writer, java.lang.Throwable exception)
public java.net.Socket getSocket()
getSocket
in interface Py4JServerConnection
public void waitForCommands()
public java.lang.String sendCommand(java.lang.String command)
sendCommand
in interface Py4JClientConnection
public java.lang.String sendCommand(java.lang.String command, boolean blocking)
sendCommand
in interface Py4JClientConnection
public void shutdown()
shutdown
in interface Py4JClientConnection
shutdown
in interface Py4JServerConnection
public void shutdown(boolean reset)
shutdown
in interface Py4JClientConnection
shutdown
in interface Py4JServerConnection
public void start() throws java.io.IOException
start
in interface Py4JClientConnection
java.io.IOException
public void setUsed(boolean used)
setUsed
in interface Py4JClientConnection
public boolean wasUsed()
wasUsed
in interface Py4JClientConnection
public boolean isInitiatedFromClient()
public void setInitiatedFromClient(boolean initiatedFromClient)
protected java.lang.String readBlockingResponse(java.io.BufferedReader reader) throws java.io.IOException
java.io.IOException
protected java.lang.String readNonBlockingResponse(java.net.Socket socket, java.io.BufferedReader reader) throws java.io.IOException
java.io.IOException