use of com.github.ambry.network.SocketNetworkClientFactory in project ambry by linkedin.
the class CloudRouterFactory method getCompositeNetworkClientFactory.
/**
* @param requestHandlerPool the pool to connect to {@link LocalNetworkClientFactory}.
* @return a {@link CompositeNetworkClientFactory} that can be used to talk to cloud managed services or ambry server
* nodes.
*/
private CompositeNetworkClientFactory getCompositeNetworkClientFactory(RequestHandlerPool requestHandlerPool) {
NetworkClientFactory cloudNetworkClientFactory = new LocalNetworkClientFactory((LocalRequestResponseChannel) requestHandlerPool.getChannel(), networkConfig, networkMetrics, time);
NetworkClientFactory diskNetworkClientFactory = null;
if (routerConfig.routerEnableHttp2NetworkClient) {
diskNetworkClientFactory = new Http2NetworkClientFactory(http2ClientMetrics, http2ClientConfig, sslFactory, time);
} else {
diskNetworkClientFactory = new SocketNetworkClientFactory(networkMetrics, networkConfig, sslFactory, routerConfig.routerScalingUnitMaxConnectionsPerPortPlainText, routerConfig.routerScalingUnitMaxConnectionsPerPortSsl, routerConfig.routerConnectionCheckoutTimeoutMs, time);
}
Map<ReplicaType, NetworkClientFactory> childFactories = new EnumMap<>(ReplicaType.class);
childFactories.put(ReplicaType.CLOUD_BACKED, cloudNetworkClientFactory);
childFactories.put(ReplicaType.DISK_BACKED, diskNetworkClientFactory);
return new CompositeNetworkClientFactory(childFactories);
}
Aggregations