Search in sources :

Example 1 with AmbryRequests

use of com.github.ambry.protocol.AmbryRequests in project ambry by linkedin.

the class CloudRouterFactory method getRequestHandlerPool.

/**
 * Utility method to build  a {@link RequestHandlerPool}.
 * @param verifiableProperties the properties to use.
 * @param clusterMap the {@link ClusterMap} to use.
 * @return the constructed {@link RequestHandlerPool}.
 * @throws Exception if the construction fails.
 */
public RequestHandlerPool getRequestHandlerPool(VerifiableProperties verifiableProperties, ClusterMap clusterMap, CloudDestination cloudDestination, CloudConfig cloudConfig) throws Exception {
    ClusterMapConfig clusterMapConfig = new ClusterMapConfig(verifiableProperties);
    MetricRegistry registry = clusterMap.getMetricRegistry();
    DataNodeId nodeId = new CloudDataNode(cloudConfig, clusterMapConfig);
    VcrMetrics vcrMetrics = new VcrMetrics(registry);
    StoreManager cloudStorageManager = new CloudStorageManager(verifiableProperties, vcrMetrics, cloudDestination, clusterMap);
    LocalRequestResponseChannel channel = new LocalRequestResponseChannel();
    ServerMetrics serverMetrics = new ServerMetrics(registry, AmbryRequests.class);
    StoreKeyFactory storeKeyFactory = new BlobIdFactory(clusterMap);
    StoreKeyConverterFactory storeKeyConverterFactory = Utils.getObj(routerConfig.routerStoreKeyConverterFactory, verifiableProperties, registry);
    // A null notification system is passed into AmbryRequests so that replication events are not emitted from a
    // frontend.
    AmbryRequests requests = new AmbryRequests(cloudStorageManager, channel, clusterMap, nodeId, registry, serverMetrics, null, null, null, storeKeyFactory, storeKeyConverterFactory);
    return new RequestHandlerPool(routerConfig.routerRequestHandlerNumOfThreads, channel, requests);
}
Also used : CloudStorageManager(com.github.ambry.cloud.CloudStorageManager) LocalRequestResponseChannel(com.github.ambry.network.LocalRequestResponseChannel) VcrMetrics(com.github.ambry.cloud.VcrMetrics) MetricRegistry(com.codahale.metrics.MetricRegistry) AmbryRequests(com.github.ambry.protocol.AmbryRequests) CloudDataNode(com.github.ambry.clustermap.CloudDataNode) ClusterMapConfig(com.github.ambry.config.ClusterMapConfig) StoreManager(com.github.ambry.server.StoreManager) BlobIdFactory(com.github.ambry.commons.BlobIdFactory) StoreKeyFactory(com.github.ambry.store.StoreKeyFactory) StoreKeyConverterFactory(com.github.ambry.store.StoreKeyConverterFactory) RequestHandlerPool(com.github.ambry.protocol.RequestHandlerPool) ServerMetrics(com.github.ambry.commons.ServerMetrics) DataNodeId(com.github.ambry.clustermap.DataNodeId)

Aggregations

MetricRegistry (com.codahale.metrics.MetricRegistry)1 CloudStorageManager (com.github.ambry.cloud.CloudStorageManager)1 VcrMetrics (com.github.ambry.cloud.VcrMetrics)1 CloudDataNode (com.github.ambry.clustermap.CloudDataNode)1 DataNodeId (com.github.ambry.clustermap.DataNodeId)1 BlobIdFactory (com.github.ambry.commons.BlobIdFactory)1 ServerMetrics (com.github.ambry.commons.ServerMetrics)1 ClusterMapConfig (com.github.ambry.config.ClusterMapConfig)1 LocalRequestResponseChannel (com.github.ambry.network.LocalRequestResponseChannel)1 AmbryRequests (com.github.ambry.protocol.AmbryRequests)1 RequestHandlerPool (com.github.ambry.protocol.RequestHandlerPool)1 StoreManager (com.github.ambry.server.StoreManager)1 StoreKeyConverterFactory (com.github.ambry.store.StoreKeyConverterFactory)1 StoreKeyFactory (com.github.ambry.store.StoreKeyFactory)1