-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add announcer status delegate interface and support getting server an…
…nounce mode
- Loading branch information
Showing
9 changed files
with
110 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
d2/src/main/java/com/linkedin/d2/balancer/servers/AnnouncerStatusDelegate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.linkedin.d2.balancer.servers; | ||
|
||
import java.net.URI; | ||
|
||
|
||
public interface AnnouncerStatusDelegate | ||
{ | ||
/** | ||
* @return true if the markup intent has been sent. | ||
*/ | ||
boolean isMarkUpIntentSent(); | ||
|
||
/** | ||
* @return true if the dark warmup mark up intent has been sent. | ||
*/ | ||
boolean isDarkWarmupMarkUpIntentSent(); | ||
|
||
/** | ||
* @return the name of the regular cluster that the announcer manages. | ||
*/ | ||
String getCluster(); | ||
|
||
/** | ||
* @return the name of the warmup cluster that the announcer manages. | ||
*/ | ||
String getWarmupCluster(); | ||
|
||
/** | ||
* @return the uri that the announcer manages. | ||
*/ | ||
URI getURI(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,7 @@ | |
* @author Francesco Capponi ([email protected]) | ||
*/ | ||
|
||
public class ZooKeeperAnnouncer implements D2ServiceDiscoveryEventHelper | ||
public class ZooKeeperAnnouncer implements D2ServiceDiscoveryEventHelper, AnnouncerStatusDelegate | ||
{ | ||
public static final boolean DEFAULT_DARK_WARMUP_ENABLED = false; | ||
public static final int DEFAULT_DARK_WARMUP_DURATION = 0; | ||
|
@@ -705,6 +705,13 @@ public void onSuccess(None result) | |
}; | ||
} | ||
|
||
@Override | ||
public String getWarmupCluster() | ||
{ | ||
return _warmupClusterName; | ||
} | ||
|
||
@Override | ||
public String getCluster() | ||
{ | ||
return _cluster; | ||
|
@@ -720,6 +727,12 @@ public String getUri() | |
return _uri.toString(); | ||
} | ||
|
||
@Override | ||
public URI getURI() | ||
{ | ||
return _uri; | ||
} | ||
|
||
public void setUri(String uri) | ||
{ | ||
_uri = URI.create(uri); | ||
|
@@ -816,11 +829,13 @@ public boolean isMarkUpFailed() | |
return _markUpFailed; | ||
} | ||
|
||
@Override | ||
public boolean isMarkUpIntentSent() | ||
{ | ||
return _isMarkUpIntentSent.get(); | ||
} | ||
|
||
@Override | ||
public boolean isDarkWarmupMarkUpIntentSent() | ||
{ | ||
return _isDarkWarmupMarkUpIntentSent.get(); | ||
|
@@ -836,6 +851,11 @@ public int getWeightDecimalPlacesBreachedCount() | |
return _weightDecimalPlacesBreachedCount.get(); | ||
} | ||
|
||
public LoadBalancerServer.AnnounceMode getServerAnnounceMode() | ||
{ | ||
return _server.getAnnounceMode(); | ||
} | ||
|
||
public void setEventEmitter(ServiceDiscoveryEventEmitter emitter) { | ||
_eventEmitter = emitter; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters