Search in sources :

Example 6 with D2ClientConfig

use of com.linkedin.d2.balancer.D2ClientConfig in project rest.li by linkedin.

the class LastSeenBalancerWithFacilitiesFactory method getUriPropertiesLastSeenZKStore.

private LastSeenZKStore<UriProperties> getUriPropertiesLastSeenZKStore(D2ClientConfig config, ZKPersistentConnection zkPersistentConnection, D2ClientJmxManager d2ClientJmxManager, ScheduledExecutorService executorService, int zookeeperReadWindowMs) {
    ZooKeeperEphemeralStoreBuilder<UriProperties> zkUrisStoreBuilder = new ZooKeeperEphemeralStoreBuilder<UriProperties>().setSerializer(new UriPropertiesJsonSerializer()).setPath(ZKFSUtil.uriPath(config.basePath)).setMerger(new UriPropertiesMerger()).setUseNewWatcher(config.useNewEphemeralStoreWatcher).setExecutorService(executorService).setZookeeperReadWindowMs(zookeeperReadWindowMs).addOnBuildListener(d2ClientJmxManager::setZkUriRegistry);
    FileStore<UriProperties> fileStore = new FileStore<>(config.fsBasePath + File.separator + ZKFSUtil.URI_PATH, new UriPropertiesJsonSerializer());
    d2ClientJmxManager.setFsUriStore(fileStore);
    if (config.enableSaveUriDataOnDisk) {
        zkUrisStoreBuilder.setBackupStoreFilePath(config.fsBasePath);
    }
    return new LastSeenZKStore<>(fileStore, zkUrisStoreBuilder, zkPersistentConnection, config._executorService, config.warmUpTimeoutSeconds, config.warmUpConcurrentRequests);
}
Also used : UriPropertiesJsonSerializer(com.linkedin.d2.balancer.properties.UriPropertiesJsonSerializer) FileStore(com.linkedin.d2.discovery.stores.file.FileStore) LastSeenZKStore(com.linkedin.d2.discovery.stores.zk.LastSeenZKStore) UriProperties(com.linkedin.d2.balancer.properties.UriProperties) UriPropertiesMerger(com.linkedin.d2.balancer.properties.UriPropertiesMerger)

Example 7 with D2ClientConfig

use of com.linkedin.d2.balancer.D2ClientConfig in project rest.li by linkedin.

the class LastSeenBalancerWithFacilitiesFactory method getServicePropertiesLastSeenZKStore.

private LastSeenZKStore<ServiceProperties> getServicePropertiesLastSeenZKStore(D2ClientConfig config, ZKPersistentConnection zkPersistentConnection, D2ClientJmxManager d2ClientJmxManager, ScheduledExecutorService executorService, int zookeeperReadWindowMs) {
    ZooKeeperPermanentStoreBuilder<ServiceProperties> zkServiceStoreBuilder = new ZooKeeperPermanentStoreBuilder<ServiceProperties>().setSerializer(new ServicePropertiesJsonSerializer(config.clientServicesConfig)).setPath(ZKFSUtil.servicePath(config.basePath, config.d2ServicePath)).setExecutorService(executorService).setZookeeperReadWindowMs(zookeeperReadWindowMs).addOnBuildListener(d2ClientJmxManager::setZkServiceRegistry);
    FileStore<ServiceProperties> fileStore = new FileStore<>(FileSystemDirectory.getServiceDirectory(config.fsBasePath, config.d2ServicePath), new ServicePropertiesJsonSerializer());
    d2ClientJmxManager.setFsServiceStore(fileStore);
    return new LastSeenZKStore<>(fileStore, zkServiceStoreBuilder, zkPersistentConnection, config._executorService, config.warmUpTimeoutSeconds, config.warmUpConcurrentRequests);
}
Also used : FileStore(com.linkedin.d2.discovery.stores.file.FileStore) ServiceProperties(com.linkedin.d2.balancer.properties.ServiceProperties) LastSeenZKStore(com.linkedin.d2.discovery.stores.zk.LastSeenZKStore) ServicePropertiesJsonSerializer(com.linkedin.d2.balancer.properties.ServicePropertiesJsonSerializer)

Aggregations

FileStore (com.linkedin.d2.discovery.stores.file.FileStore)3 LastSeenZKStore (com.linkedin.d2.discovery.stores.zk.LastSeenZKStore)3 ClusterProperties (com.linkedin.d2.balancer.properties.ClusterProperties)2 ServiceProperties (com.linkedin.d2.balancer.properties.ServiceProperties)2 UriProperties (com.linkedin.d2.balancer.properties.UriProperties)2 WarmUpLoadBalancer (com.linkedin.d2.balancer.util.WarmUpLoadBalancer)2 D2ClientJmxManager (com.linkedin.d2.jmx.D2ClientJmxManager)2 BackupRequestsClient (com.linkedin.d2.balancer.clients.BackupRequestsClient)1 DynamicClient (com.linkedin.d2.balancer.clients.DynamicClient)1 RequestTimeoutClient (com.linkedin.d2.balancer.clients.RequestTimeoutClient)1 RetryClient (com.linkedin.d2.balancer.clients.RetryClient)1 ClusterPropertiesJsonSerializer (com.linkedin.d2.balancer.properties.ClusterPropertiesJsonSerializer)1 ServicePropertiesJsonSerializer (com.linkedin.d2.balancer.properties.ServicePropertiesJsonSerializer)1 UriPropertiesJsonSerializer (com.linkedin.d2.balancer.properties.UriPropertiesJsonSerializer)1 UriPropertiesMerger (com.linkedin.d2.balancer.properties.UriPropertiesMerger)1 SimpleLoadBalancer (com.linkedin.d2.balancer.simple.SimpleLoadBalancer)1 SimpleLoadBalancerState (com.linkedin.d2.balancer.simple.SimpleLoadBalancerState)1 LoadBalancerStrategy (com.linkedin.d2.balancer.strategies.LoadBalancerStrategy)1 LoadBalancerStrategyFactory (com.linkedin.d2.balancer.strategies.LoadBalancerStrategyFactory)1 RandomLoadBalancerStrategyFactory (com.linkedin.d2.balancer.strategies.random.RandomLoadBalancerStrategyFactory)1