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