Search in sources :

Example 1 with Http2NetworkClientFactory

use of com.github.ambry.network.http2.Http2NetworkClientFactory 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);
}
Also used : LocalNetworkClientFactory(com.github.ambry.network.LocalNetworkClientFactory) CompositeNetworkClientFactory(com.github.ambry.network.CompositeNetworkClientFactory) SocketNetworkClientFactory(com.github.ambry.network.SocketNetworkClientFactory) ReplicaType(com.github.ambry.clustermap.ReplicaType) Http2NetworkClientFactory(com.github.ambry.network.http2.Http2NetworkClientFactory) LocalNetworkClientFactory(com.github.ambry.network.LocalNetworkClientFactory) SocketNetworkClientFactory(com.github.ambry.network.SocketNetworkClientFactory) NetworkClientFactory(com.github.ambry.network.NetworkClientFactory) CompositeNetworkClientFactory(com.github.ambry.network.CompositeNetworkClientFactory) Http2NetworkClientFactory(com.github.ambry.network.http2.Http2NetworkClientFactory) EnumMap(java.util.EnumMap)

Aggregations

ReplicaType (com.github.ambry.clustermap.ReplicaType)1 CompositeNetworkClientFactory (com.github.ambry.network.CompositeNetworkClientFactory)1 LocalNetworkClientFactory (com.github.ambry.network.LocalNetworkClientFactory)1 NetworkClientFactory (com.github.ambry.network.NetworkClientFactory)1 SocketNetworkClientFactory (com.github.ambry.network.SocketNetworkClientFactory)1 Http2NetworkClientFactory (com.github.ambry.network.http2.Http2NetworkClientFactory)1 EnumMap (java.util.EnumMap)1