Class D2Server

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void forceStart()
      Manually start the d2 server.
      java.lang.String getAnnouncingTargetID()
      Get a ID string consists of the attributes that uniquely define the announcing target, which are: 1) doNotStart 2) zkHosts 3) zk announcers (clusterName + nodeUri) -- Note that there should be exactly one announcer according to the current usage in D2ServerFactory.
      java.util.Set<java.lang.String> getNodeUris()  
      com.linkedin.d2.balancer.servers.ZooKeeperAnnouncer[] getZkAnnouncers()  
      boolean isDelayStart()  
      boolean isEqual​(D2Server other)
      Compare D2Server to another one to check quality.
      boolean isStarted()  
      void notifyShutdown()  
      void notifyStartup()  
      void register()
      Register the instance with the service discovery system.
      void unregister()
      Unregister the instance from the service discovery system.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • notifyShutdown

        public void notifyShutdown()
      • notifyStartup

        public void notifyStartup()
      • forceStart

        public void forceStart()
        Manually start the d2 server. This method will only take effects when automatic start up is disabled by _delayStart.
      • getZkAnnouncers

        public com.linkedin.d2.balancer.servers.ZooKeeperAnnouncer[] getZkAnnouncers()
      • getNodeUris

        public java.util.Set<java.lang.String> getNodeUris()
      • isStarted

        public boolean isStarted()
      • isDelayStart

        public boolean isDelayStart()
      • isEqual

        public boolean isEqual​(D2Server other)
        Compare D2Server to another one to check quality. When ALL of the following conditions are met, two d2 servers are considered equal: 1. having the same value in doNotStart. 2. having the same zk connect string (connecting to the same zk cluster). 3. having the same number of announcers. Note there should be exactly one announcer according to the current usage in D2ServerFactory. 4. Announcers are the same with the same cluster name (announcing to the same cluster) AND same node uri (announcing for the same host).
        Parameters:
        other - the other D2Server to check against.
        Returns:
        true, if equal; false, if not.
      • getAnnouncingTargetID

        public java.lang.String getAnnouncingTargetID()
        Get a ID string consists of the attributes that uniquely define the announcing target, which are: 1) doNotStart 2) zkHosts 3) zk announcers (clusterName + nodeUri) -- Note that there should be exactly one announcer according to the current usage in D2ServerFactory. Sample ID string: { doNotStart=false, zkHosts=zk.prod-lor1, zkAnnouncers=[ {clusterName=cluster1, nodeUri=uri1} ]}
        Returns:
        a ID string of the announcing target.