public class GatewayConnection
extends java.lang.Object
implements java.lang.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 java.util.List<java.lang.Class<? extends Command>> |
baseCommands |
protected java.util.Map<java.lang.String,Command> |
commands |
protected java.util.List<GatewayServerListener> |
listeners |
protected java.util.logging.Logger |
logger |
protected java.io.BufferedReader |
reader |
protected java.net.Socket |
socket |
protected java.io.BufferedWriter |
writer |
Constructor and Description |
---|
GatewayConnection(Gateway gateway,
java.net.Socket socket) |
GatewayConnection(Gateway gateway,
java.net.Socket socket,
java.util.List<java.lang.Class<? extends Command>> customCommands,
java.util.List<GatewayServerListener> listeners) |
Modifier and Type | Method and Description |
---|---|
protected void |
fireConnectionStopped() |
static java.util.List<java.lang.Class<? extends Command>> |
getBaseCommands() |
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.
|
protected void |
quietSendError(java.io.BufferedWriter writer,
java.lang.Throwable exception) |
void |
run() |
protected static final java.util.List<java.lang.Class<? extends Command>> baseCommands
protected final java.net.Socket socket
protected final java.io.BufferedWriter writer
protected final java.io.BufferedReader reader
protected final java.util.Map<java.lang.String,Command> commands
protected final java.util.logging.Logger logger
protected final java.util.List<GatewayServerListener> listeners
public GatewayConnection(Gateway gateway, java.net.Socket socket) throws java.io.IOException
java.io.IOException
public GatewayConnection(Gateway gateway, java.net.Socket socket, java.util.List<java.lang.Class<? extends Command>> customCommands, java.util.List<GatewayServerListener> listeners) throws java.io.IOException
java.io.IOException
public static java.util.List<java.lang.Class<? extends Command>> getBaseCommands()
GatewayServer
.protected void fireConnectionStopped()
public 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.
gateway
- protected void quietSendError(java.io.BufferedWriter writer, java.lang.Throwable exception)
public void run()
run
in interface java.lang.Runnable