public class ClientServerConnection extends java.lang.Object implements Py4JServerConnection, Py4JClientConnection, java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,Command> |
commands |
protected Py4JJavaServer |
javaServer |
protected java.util.logging.Logger |
logger |
protected Py4JPythonClient |
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,
Py4JPythonClient pythonClient,
Py4JJavaServer javaServer) |
Modifier and Type | Method and Description |
---|---|
protected void |
fireConnectionStopped() |
java.net.Socket |
getSocket() |
static ClientServerConnection |
getThreadConnection() |
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 |
quietSendError(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) |
static void |
setThreadConnection(ClientServerConnection clientServerConnection) |
void |
setUsed(boolean used) |
void |
shutdown() |
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 Py4JPythonClient pythonClient
public ClientServerConnection(Gateway gateway, java.net.Socket socket, java.util.List<java.lang.Class<? extends Command>> customCommands, Py4JPythonClient pythonClient, Py4JJavaServer javaServer) throws java.io.IOException
java.io.IOException
public void startServerConnection()
public static ClientServerConnection getThreadConnection()
public static void setThreadConnection(ClientServerConnection clientServerConnection)
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 quietSendError(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
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