Package py4j

Interface Py4JPythonClient

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Py4JPythonClient copyWith​(java.net.InetAddress pythonAddress, int pythonPort)
      Creates a callback client which connects to the given address and port, but retains all the other settings (like the minConnectionTime and the socketFactory).
      java.net.InetAddress getAddress()  
      int getPort()  
      java.lang.Object getPythonServerEntryPoint​(Gateway gateway, java.lang.Class[] interfacesToImplement)
      Gets a reference to the entry point on the Python side.
      int getReadTimeout()  
      boolean isMemoryManagementEnabled()  
      java.lang.String sendCommand​(java.lang.String command)
      Sends a command to the Python side.
      java.lang.String sendCommand​(java.lang.String command, boolean blocking)
      Sends a command to the Python side.
      void shutdown()
      Closes all active channels, stops the periodic cleanup of channels and mark the client as shutting down.
    • Method Detail

      • sendCommand

        java.lang.String sendCommand​(java.lang.String command)

        Sends a command to the Python side. This method is typically used by Python proxies to call Python methods or to request the garbage collection of a proxy.

        Parameters:
        command - The command to send.
        Returns:
        The response.
      • sendCommand

        java.lang.String sendCommand​(java.lang.String command,
                                     boolean blocking)

        Sends a command to the Python side. This method is typically used by Python proxies to call Python methods or to request the garbage collection of a proxy.

        Parameters:
        command - The command to send.
        blocking - If the CallbackClient should wait for an answer (default should be True, except for critical cases such as a finalizer sending a command).
        Returns:
        The response.
      • shutdown

        void shutdown()

        Closes all active channels, stops the periodic cleanup of channels and mark the client as shutting down. No more commands can be sent after this method has been called, except commands that were initiated before the shutdown method was called..

      • copyWith

        Py4JPythonClient copyWith​(java.net.InetAddress pythonAddress,
                                  int pythonPort)

        Creates a callback client which connects to the given address and port, but retains all the other settings (like the minConnectionTime and the socketFactory). This method is useful if for some reason your CallbackServer changes its address or you come to know of the address after Gateway has already instantiated.

        Parameters:
        pythonAddress - The address used by a PythonProxyHandler to connect to a Python gateway.
        pythonPort - The port used by a PythonProxyHandler to connect to a Python gateway. Essentially the port used for Python callbacks.
      • isMemoryManagementEnabled

        boolean isMemoryManagementEnabled()
      • getPort

        int getPort()
      • getReadTimeout

        int getReadTimeout()
      • getAddress

        java.net.InetAddress getAddress()
      • getPythonServerEntryPoint

        java.lang.Object getPythonServerEntryPoint​(Gateway gateway,
                                                   java.lang.Class[] interfacesToImplement)

        Gets a reference to the entry point on the Python side. This is often necessary if Java is driving the communication because Java cannot call static methods, initialize Python objects or load Python modules yet.

        Parameters:
        gateway -
        interfacesToImplement -
        Returns: