Class D2ControllerClient

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class D2ControllerClient
    extends ControllerClient
    • Constructor Detail

      • D2ControllerClient

        public D2ControllerClient​(java.lang.String d2ServiceName,
                                  java.lang.String clusterName,
                                  java.lang.String d2ZkHost,
                                  java.util.Optional<SSLFactory> sslFactory)
      • D2ControllerClient

        public D2ControllerClient​(java.lang.String d2ServiceName,
                                  java.lang.String clusterName,
                                  com.linkedin.d2.balancer.D2Client d2Client)
      • D2ControllerClient

        public D2ControllerClient​(java.lang.String d2ServiceName,
                                  java.lang.String clusterName,
                                  com.linkedin.d2.balancer.D2Client d2Client,
                                  java.util.Optional<SSLFactory> sslFactory)
      • D2ControllerClient

        public D2ControllerClient​(java.lang.String d2ServiceName,
                                  java.lang.String clusterName,
                                  java.util.List<com.linkedin.d2.balancer.D2Client> d2Clients,
                                  java.util.Optional<SSLFactory> sslFactory)
      • D2ControllerClient

        public D2ControllerClient​(java.lang.String d2ServiceName,
                                  java.lang.String clusterName,
                                  java.util.Optional<SSLFactory> sslFactory,
                                  java.util.List<java.lang.String> d2ZkHosts)
    • Method Detail

      • discoverLeaderController

        protected java.lang.String discoverLeaderController()
        Discover leader controller from a list of D2 Clients.
        Overrides:
        discoverLeaderController in class ControllerClient
        Returns:
        leader controller url
      • discoverCluster

        public static D2ServiceDiscoveryResponse discoverCluster​(com.linkedin.d2.balancer.D2Client d2Client,
                                                                 java.lang.String d2ServiceName,
                                                                 java.lang.String storeName)
      • discoverCluster

        @Deprecated
        public static D2ServiceDiscoveryResponse discoverCluster​(java.lang.String d2ZkHost,
                                                                 java.lang.String d2ServiceName,
                                                                 java.lang.String storeName,
                                                                 int retryAttempts)
        Deprecated.
      • discoverCluster

        public static D2ServiceDiscoveryResponse discoverCluster​(java.lang.String d2ZkHost,
                                                                 java.lang.String d2ServiceName,
                                                                 java.lang.String storeName,
                                                                 int retryAttempts,
                                                                 java.util.Optional<SSLFactory> sslFactory)
      • discoverCluster

        public static D2ServiceDiscoveryResponse discoverCluster​(com.linkedin.d2.balancer.D2Client d2Client,
                                                                 java.lang.String d2ServiceName,
                                                                 java.lang.String storeName,
                                                                 int retryAttempts)
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class ControllerClient
      • convertToSecureUrl

        @Deprecated
        public static java.net.URL convertToSecureUrl​(java.net.URL url)
                                               throws java.net.MalformedURLException
        Deprecated.
        Convert a HTTP url to HTTPS url with 1578 port number; TODO: remove the below helper functions after Controller ACL migration.
        Throws:
        java.net.MalformedURLException
      • convertToSecureUrl

        @Deprecated
        public static java.net.URL convertToSecureUrl​(java.net.URL url,
                                                      int port)
                                               throws java.net.MalformedURLException
        Deprecated.
        Convert a HTTP url to HTTPS url with specific port number; TODO: remove the below helper functions after Controller ACL migration.
        Throws:
        java.net.MalformedURLException