use of com.linkedin.d2.DarkClusterConfigMap in project rest.li by linkedin.
the class SimpleLoadBalancer method getDarkClusterConfigMap.
@Override
public void getDarkClusterConfigMap(String clusterName, Callback<DarkClusterConfigMap> callback) {
Callback<DarkClusterConfigMap> wrappedCallback = new TimeoutCallback<>(_executor, _timeout, _unit, callback);
_state.listenToCluster(clusterName, (type, name) -> {
ClusterProperties clusterProperties = _state.getClusterProperties(clusterName).getProperty();
DarkClusterConfigMap darkClusterConfigMap = clusterProperties != null ? clusterProperties.accessDarkClusters() : new DarkClusterConfigMap();
wrappedCallback.onSuccess(darkClusterConfigMap);
});
}
use of com.linkedin.d2.DarkClusterConfigMap in project rest.li by linkedin.
the class SimpleLoadBalancer method getDarkClusterConfigMap.
@Override
public DarkClusterConfigMap getDarkClusterConfigMap(String clusterName) throws ServiceUnavailableException {
FutureCallback<DarkClusterConfigMap> darkClusterConfigMapFutureCallback = new FutureCallback<>();
getDarkClusterConfigMap(clusterName, darkClusterConfigMapFutureCallback);
try {
return darkClusterConfigMapFutureCallback.get(_timeout, _unit);
} catch (ExecutionException | TimeoutException | IllegalStateException | InterruptedException e) {
die("ClusterInfo", "PEGA_1018, unable to retrieve dark cluster info for cluster: " + clusterName + ", exception: " + e);
return new DarkClusterConfigMap();
}
}
Aggregations