Search in sources :

Example 21 with ZooKeeperPermanentStore

use of com.linkedin.d2.discovery.stores.zk.ZooKeeperPermanentStore in project rest.li by linkedin.

the class LoadBalancerClientCli method hasService.

public static boolean hasService(ZKConnection zkclient, String zkserver, String d2path, String cluster, String service) throws URISyntaxException, IOException, PropertyStoreException {
    ZooKeeperPermanentStore<ServiceProperties> zkServiceRegistry = null;
    String scstoreString = zkserver + ZKFSUtil.servicePath(d2path);
    zkServiceRegistry = (ZooKeeperPermanentStore<ServiceProperties>) getStore(zkclient, scstoreString, new ServicePropertiesJsonSerializer());
    return zkServiceRegistry.get(service).getClusterName().equals(cluster);
}
Also used : ServiceProperties(com.linkedin.d2.balancer.properties.ServiceProperties) ServicePropertiesJsonSerializer(com.linkedin.d2.balancer.properties.ServicePropertiesJsonSerializer)

Aggregations

ServiceProperties (com.linkedin.d2.balancer.properties.ServiceProperties)13 ServicePropertiesJsonSerializer (com.linkedin.d2.balancer.properties.ServicePropertiesJsonSerializer)13 ZooKeeperPermanentStore (com.linkedin.d2.discovery.stores.zk.ZooKeeperPermanentStore)12 None (com.linkedin.common.util.None)10 ClusterProperties (com.linkedin.d2.balancer.properties.ClusterProperties)10 ClusterPropertiesJsonSerializer (com.linkedin.d2.balancer.properties.ClusterPropertiesJsonSerializer)10 UriProperties (com.linkedin.d2.balancer.properties.UriProperties)9 UriPropertiesJsonSerializer (com.linkedin.d2.balancer.properties.UriPropertiesJsonSerializer)9 UriPropertiesMerger (com.linkedin.d2.balancer.properties.UriPropertiesMerger)9 FutureCallback (com.linkedin.common.callback.FutureCallback)8 ZKConnection (com.linkedin.d2.discovery.stores.zk.ZKConnection)7 ZooKeeperEphemeralStore (com.linkedin.d2.discovery.stores.zk.ZooKeeperEphemeralStore)6 HashMap (java.util.HashMap)6 PropertyEventBusImpl (com.linkedin.d2.discovery.event.PropertyEventBusImpl)5 Test (org.testng.annotations.Test)5 SimpleLoadBalancer (com.linkedin.d2.balancer.simple.SimpleLoadBalancer)3 SimpleLoadBalancerState (com.linkedin.d2.balancer.simple.SimpleLoadBalancerState)3 PropertyStringSerializer (com.linkedin.d2.discovery.stores.PropertyStringSerializer)3 HashSet (java.util.HashSet)3 List (java.util.List)3