Package py4j

Class PythonClient

    • Field Detail

      • gateway

        protected Gateway gateway
      • customCommands

        protected java.util.List<java.lang.Class<? extends Command>> customCommands
      • logger

        protected final java.util.logging.Logger logger
      • threadConnection

        protected java.lang.ThreadLocal<java.lang.ref.WeakReference<ClientServerConnection>> threadConnection
      • readTimeout

        protected final int readTimeout
    • Constructor Detail

      • PythonClient

        public PythonClient​(Gateway gateway,
                            java.util.List<java.lang.Class<? extends Command>> customCommands,
                            int pythonPort,
                            java.net.InetAddress pythonAddress,
                            long minConnectionTime,
                            java.util.concurrent.TimeUnit minConnectionTimeUnit,
                            javax.net.SocketFactory socketFactory,
                            Py4JJavaServer javaServer)
        Parameters:
        gateway - The gateway used to pool Java instances created on the Python side.
        customCommands - Optional list of custom commands that can be invoked by the Python side.
        pythonPort - Port the PythonClient should connect to.
        pythonAddress - Address (IP) the PythonClient should connect to.
        minConnectionTime - Minimum time to wait before closing unused connections. Not used with PythonClient.
        minConnectionTimeUnit - Time unit of minConnectionTime
        socketFactory - SocketFactory used to create a socket.
        javaServer - The JavaServer used to receive commands from the Python side.
      • PythonClient

        public PythonClient​(Gateway gateway,
                            java.util.List<java.lang.Class<? extends Command>> customCommands,
                            int pythonPort,
                            java.net.InetAddress pythonAddress,
                            long minConnectionTime,
                            java.util.concurrent.TimeUnit minConnectionTimeUnit,
                            javax.net.SocketFactory socketFactory,
                            Py4JJavaServer javaServer,
                            boolean enableMemoryManagement,
                            int readTimeout)
        Parameters:
        gateway - The gateway used to pool Java instances created on the Python side.
        customCommands - Optional list of custom commands that can be invoked by the Python side.
        pythonPort - Port the PythonClient should connect to.
        pythonAddress - Address (IP) the PythonClient should connect to.
        minConnectionTime - Minimum time to wait before closing unused connections. Not used with PythonClient.
        minConnectionTimeUnit - Time unit of minConnectionTime
        socketFactory - SocketFactory used to create a socket.
        javaServer - The JavaServer used to receive commands from the Python side.
        enableMemoryManagement - If false, the Java side does not tell the Python side when a Python proxy is garbage collected.
        readTimeout - Time in milliseconds (0 = infinite). Once connected to the Python side, if the Java side does not receive a response after this time, the connection with the Python program is closed. If readTimeout = 0, a default readTimeout of 1000 is used for operations that must absolutely be non-blocking.
      • PythonClient

        public PythonClient​(Gateway gateway,
                            java.util.List<java.lang.Class<? extends Command>> customCommands,
                            int pythonPort,
                            java.net.InetAddress pythonAddress,
                            long minConnectionTime,
                            java.util.concurrent.TimeUnit minConnectionTimeUnit,
                            javax.net.SocketFactory socketFactory,
                            Py4JJavaServer javaServer,
                            boolean enableMemoryManagement,
                            int readTimeout,
                            java.lang.String authToken)
        Parameters:
        gateway - The gateway used to pool Java instances created on the Python side.
        customCommands - Optional list of custom commands that can be invoked by the Python side.
        pythonPort - Port the PythonClient should connect to.
        pythonAddress - Address (IP) the PythonClient should connect to.
        minConnectionTime - Minimum time to wait before closing unused connections. Not used with PythonClient.
        minConnectionTimeUnit - Time unit of minConnectionTime
        socketFactory - SocketFactory used to create a socket.
        javaServer - The JavaServer used to receive commands from the Python side.
        enableMemoryManagement - If false, the Java side does not tell the Python side when a Python proxy is garbage collected.
        readTimeout - Time in milliseconds (0 = infinite). Once connected to the Python side, if the Java side does not receive a response after this time, the connection with the Python program is closed. If readTimeout = 0, a default readTimeout of 1000 is used for operations that must absolutely be non-blocking.
        authToken - Token for authenticating with the callback server.