Package io.grpc

Class Grpc

  • public final class Grpc
    extends Object
    Stuff that are part of the public API but are not bound to particular classes, e.g., static methods, constants, attribute and context keys.
    • Method Detail

      • newChannelBuilder

        public static ManagedChannelBuilder<?> newChannelBuilder​(String target,
                                                                 ChannelCredentials creds)
        Creates a channel builder with a target string and credentials. The target can be either a valid NameResolver-compliant URI, or an authority string.

        A NameResolver-compliant URI is an absolute hierarchical URI as defined by URI. Example URIs:

        • "dns:///"
        • "dns:///"
        • "dns:///%5B2001:db8:85a3:8d3:1319:8a2e:370:7348%5D:443"
        • "dns://"
        • "dns://"
        • "zookeeper://"

        An authority string will be converted to a NameResolver-compliant URI, which has the scheme from the name resolver with the highest priority (e.g. "dns"), no authority, and the original authority string as its path after properly escaped. We recommend libraries to specify the schema explicitly if it is known, since libraries cannot know which NameResolver will be default during runtime. Example authority strings:

        • "localhost"
        • ""
        • "localhost:8080"
        • ""
        • ""
        • "[2001:db8:85a3:8d3:1319:8a2e:370:7348]"
        • "[2001:db8:85a3:8d3:1319:8a2e:370:7348]:443"
      • newServerBuilderForPort

        public static ServerBuilder<?> newServerBuilderForPort​(int port,
                                                               ServerCredentials creds)
        Static factory for creating a new ServerBuilder.
        port - the port to listen on
        creds - the server identity