Class D2Server

java.lang.Object
com.linkedin.venice.d2.D2Server
All Implemented Interfaces:
ServiceDiscoveryAnnouncer

public class D2Server extends Object implements ServiceDiscoveryAnnouncer
  • Constructor Details

  • Method Details

    • 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 Set<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 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.
    • register

      public void register()
      Description copied from interface: ServiceDiscoveryAnnouncer
      Register the instance with the service discovery system.
      Specified by:
      register in interface ServiceDiscoveryAnnouncer
    • unregister

      public void unregister()
      Description copied from interface: ServiceDiscoveryAnnouncer
      Unregister the instance from the service discovery system.
      Specified by:
      unregister in interface ServiceDiscoveryAnnouncer
    • toString

      public String toString()
      Overrides:
      toString in class Object