Package com.linkedin.venice.d2
Class D2Server
- java.lang.Object
-
- com.linkedin.venice.d2.D2Server
-
- All Implemented Interfaces:
ServiceDiscoveryAnnouncer
public class D2Server extends java.lang.Object implements ServiceDiscoveryAnnouncer
-
-
Constructor Summary
Constructors Constructor Description D2Server(D2ServerManager d2ServerManager)
-
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 inD2ServerFactory
.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.java.lang.String
toString()
void
unregister()
Unregister the instance from the service discovery system.
-
-
-
Constructor Detail
-
D2Server
public D2Server(D2ServerManager d2ServerManager)
-
-
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 inD2ServerFactory
. 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 inD2ServerFactory
. 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 interfaceServiceDiscoveryAnnouncer
-
unregister
public void unregister()
Description copied from interface:ServiceDiscoveryAnnouncer
Unregister the instance from the service discovery system.- Specified by:
unregister
in interfaceServiceDiscoveryAnnouncer
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-