Class TServerUtils


  • public class TServerUtils
    extends Object
    Factory methods for creating Thrift server objects
    • Constructor Detail

      • TServerUtils

        public TServerUtils()
    • Method Detail

      • getHostAndPorts

        public static HostAndPort[] getHostAndPorts​(String hostname,
                                                    IntStream ports)
        Parameters:
        hostname - name of the host
        ports - array of ports
        Returns:
        array of HostAndPort objects
      • startServer

        public static ServerAddress startServer​(ServerContext context,
                                                String hostname,
                                                Property portHintProperty,
                                                org.apache.thrift.TProcessor processor,
                                                String serverName,
                                                String threadName,
                                                Property portSearchProperty,
                                                Property minThreadProperty,
                                                Property threadTimeOutProperty,
                                                Property timeBetweenThreadChecksProperty,
                                                Property maxMessageSizeProperty)
                                         throws UnknownHostException
        Start a server, at the given port, or higher, if that port is not available.
        Parameters:
        context - RPC configuration
        portHintProperty - the port to attempt to open, can be zero, meaning "any available port"
        processor - the service to be started
        serverName - the name of the class that is providing the service
        threadName - name this service's thread for better debugging
        portSearchProperty - A boolean Property to control if port-search should be used, or null to disable
        minThreadProperty - A Property to control the minimum number of threads in the pool
        timeBetweenThreadChecksProperty - A Property to control the amount of time between checks to resize the thread pool
        maxMessageSizeProperty - A Property to control the maximum Thrift message size accepted
        Returns:
        the server object created, and the port actually used
        Throws:
        UnknownHostException - when we don't know our own address