Search in sources :

Example 6 with FileStore

use of com.linkedin.d2.discovery.stores.file.FileStore 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 FileStore

use of com.linkedin.d2.discovery.stores.file.FileStore 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)6 ClusterProperties (com.linkedin.d2.balancer.properties.ClusterProperties)3 ClusterPropertiesJsonSerializer (com.linkedin.d2.balancer.properties.ClusterPropertiesJsonSerializer)3 ServiceProperties (com.linkedin.d2.balancer.properties.ServiceProperties)3 ServicePropertiesJsonSerializer (com.linkedin.d2.balancer.properties.ServicePropertiesJsonSerializer)3 UriProperties (com.linkedin.d2.balancer.properties.UriProperties)3 UriPropertiesJsonSerializer (com.linkedin.d2.balancer.properties.UriPropertiesJsonSerializer)3 UriPropertiesMerger (com.linkedin.d2.balancer.properties.UriPropertiesMerger)3 LastSeenZKStore (com.linkedin.d2.discovery.stores.zk.LastSeenZKStore)3 SimpleLoadBalancer (com.linkedin.d2.balancer.simple.SimpleLoadBalancer)2 SimpleLoadBalancerState (com.linkedin.d2.balancer.simple.SimpleLoadBalancerState)2 PropertyEventBusImpl (com.linkedin.d2.discovery.event.PropertyEventBusImpl)2 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 None (com.linkedin.common.util.None)1 LoadBalancerStrategy (com.linkedin.d2.balancer.strategies.LoadBalancerStrategy)1 LoadBalancerStrategyFactory (com.linkedin.d2.balancer.strategies.LoadBalancerStrategyFactory)1 DegraderLoadBalancerStrategyFactoryV3 (com.linkedin.d2.balancer.strategies.degrader.DegraderLoadBalancerStrategyFactoryV3)1 TogglingLoadBalancer (com.linkedin.d2.balancer.util.TogglingLoadBalancer)1 PropertyEventThread (com.linkedin.d2.discovery.event.PropertyEventThread)1