Package py4j
Interface Py4JJavaServer
- All Known Implementing Classes:
GatewayServer
,JavaServer
public interface Py4JJavaServer
Interface that describes the operations a server must support to receive requests from the Python side.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(GatewayServerListener listener) int
int
getPort()
int
void
removeListener
(GatewayServerListener listener) void
shutdown()
Stops accepting connections, closes all current connections, and callsGateway.shutdown()
void
shutdown
(boolean shutdownCallbackClient) Stops accepting connections, closes all current connections, and callsGateway.shutdown()
void
start()
Starts to accept connections in a second thread (non-blocking call).void
start
(boolean fork) Starts to accept connections.
-
Method Details
-
getListeners
List<GatewayServerListener> getListeners()- Returns:
- An unmodifiable list of listeners
-
getAddress
InetAddress getAddress() -
getGateway
Gateway getGateway() -
getListeningPort
int getListeningPort() -
getPort
int getPort() -
getPythonAddress
InetAddress getPythonAddress() -
getPythonPort
int getPythonPort() -
removeListener
-
shutdown
void shutdown()Stops accepting connections, closes all current connections, and calls
Gateway.shutdown()
-
shutdown
void shutdown(boolean shutdownCallbackClient) Stops accepting connections, closes all current connections, and calls
Gateway.shutdown()
- Parameters:
shutdownCallbackClient
- If True, shuts down the CallbackClient instance.
-
addListener
-
start
void start()Starts to accept connections in a second thread (non-blocking call).
-
start
void start(boolean fork) Starts to accept connections.
- Parameters:
fork
- If true, the GatewayServer accepts connection in another thread and this call is non-blocking. If False, the GatewayServer accepts connection in this thread and the call is blocking (until the Gateway is shutdown by another thread).- Throws:
Py4JNetworkException
- If the server socket cannot start.
-