public class GatewayConnection extends Object implements Runnable
Manage the connection between a Python program and a Gateway. A GatewayConnection lives in its own thread and is created on demand (e.g., one per concurrent thread).
The request to connect to the JVM goes through the GatewayServer
first and is then passed to a GatewayConnection.
This class is not intended to be directly accessed by users.
Modifier and Type | Field and Description |
---|---|
protected static List<Class<? extends py4j.commands.Command>> |
baseCommands |
protected Map<String,py4j.commands.Command> |
commands |
protected List<GatewayServerListener> |
listeners |
protected Logger |
logger |
protected BufferedReader |
reader |
protected Socket |
socket |
protected BufferedWriter |
writer |
Constructor and Description |
---|
GatewayConnection(Gateway gateway,
Socket socket) |
GatewayConnection(Gateway gateway,
Socket socket,
List<Class<? extends py4j.commands.Command>> customCommands,
List<GatewayServerListener> listeners) |
Modifier and Type | Method and Description |
---|---|
protected void |
fireConnectionStopped() |
static List<Class<? extends py4j.commands.Command>> |
getBaseCommands() |
Socket |
getSocket() |
protected void |
initCommands(Gateway gateway,
List<Class<? extends py4j.commands.Command>> commandsClazz)
Override this method to initialize custom commands.
|
protected void |
quietSendError(BufferedWriter writer,
Throwable exception) |
void |
run() |
protected final Socket socket
protected final BufferedWriter writer
protected final BufferedReader reader
protected final Logger logger
protected final List<GatewayServerListener> listeners
public GatewayConnection(Gateway gateway, Socket socket) throws IOException
IOException
public GatewayConnection(Gateway gateway, Socket socket, List<Class<? extends py4j.commands.Command>> customCommands, List<GatewayServerListener> listeners) throws IOException
IOException
public static List<Class<? extends py4j.commands.Command>> getBaseCommands()
GatewayServer
.protected void fireConnectionStopped()
public Socket getSocket()
protected void initCommands(Gateway gateway, List<Class<? extends py4j.commands.Command>> commandsClazz)
Override this method to initialize custom commands.
gateway
- protected void quietSendError(BufferedWriter writer, Throwable exception)