Package com.linkedin.venice.router
Class RouterServer
- java.lang.Object
-
- com.linkedin.venice.service.AbstractVeniceService
-
- com.linkedin.venice.router.RouterServer
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class RouterServer extends AbstractVeniceService
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.linkedin.venice.service.AbstractVeniceService
AbstractVeniceService.ServiceState
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_CLUSTER_DISCOVERY_D2_SERVICE_NAME
static java.util.Collection<MetricEntity>
ROUTER_SERVICE_METRIC_ENTITIES
static java.lang.String
ROUTER_SERVICE_METRIC_PREFIX
static java.lang.String
ROUTER_SERVICE_NAME
-
Fields inherited from class com.linkedin.venice.service.AbstractVeniceService
logger, serviceState
-
-
Constructor Summary
Constructors Constructor Description RouterServer(VeniceProperties properties, HelixCustomizedViewOfflinePushRepository routingDataRepository, java.util.Optional<HelixHybridStoreQuotaRepository> hybridStoreQuotaRepository, HelixReadOnlyStoreRepository metadataRepository, HelixReadOnlySchemaRepository schemaRepository, HelixReadOnlyStoreConfigRepository storeConfigRepository, java.util.List<ServiceDiscoveryAnnouncer> serviceDiscoveryAnnouncers, java.util.Optional<SSLFactory> sslFactory, HelixLiveInstanceMonitor liveInstanceMonitor)
Only use this constructor for testing when you want to pass mock repositories Having separate constructors just for tests is hard to maintain, especially since in this case, the test constructor does not initialize manager...RouterServer(VeniceProperties properties, java.util.List<ServiceDiscoveryAnnouncer> serviceDiscoveryAnnouncers, java.util.Optional<DynamicAccessController> accessController, java.util.Optional<SSLFactory> sslFactory)
RouterServer(VeniceProperties properties, java.util.List<ServiceDiscoveryAnnouncer> serviceDiscoveryAnnouncers, java.util.Optional<DynamicAccessController> accessController, java.util.Optional<SSLFactory> sslFactory, io.tehuti.metrics.MetricsRepository metricsRepository)
RouterServer(VeniceProperties properties, java.util.List<ServiceDiscoveryAnnouncer> serviceDiscoveryAnnouncers, java.util.Optional<DynamicAccessController> accessController, java.util.Optional<SSLFactory> sslFactory, io.tehuti.metrics.MetricsRepository metricsRepository, com.linkedin.d2.balancer.D2Client d2Client, java.lang.String d2ServiceName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOptionalChannelHandler(java.lang.String key, io.netty.channel.ChannelHandler channelHandler)
VeniceRouterConfig
getConfig()
ReadOnlyStoreRepository
getMetadataRepository()
io.tehuti.metrics.MetricsRepository
getMetricsRepository()
ZkRoutersClusterManager
getRoutersClusterManager()
HelixBaseRoutingRepository
getRoutingDataRepository()
ReadOnlySchemaRepository
getSchemaRepository()
static void
main(java.lang.String[] args)
void
refresh()
static void
run(java.lang.String routerConfigFilePath, boolean runForever)
void
setReadRequestThrottling(boolean throttle)
boolean
startInner()
void
stopInner()
-
-
-
Field Detail
-
DEFAULT_CLUSTER_DISCOVERY_D2_SERVICE_NAME
public static final java.lang.String DEFAULT_CLUSTER_DISCOVERY_D2_SERVICE_NAME
- See Also:
- Constant Field Values
-
ROUTER_SERVICE_NAME
public static final java.lang.String ROUTER_SERVICE_NAME
- See Also:
- Constant Field Values
-
ROUTER_SERVICE_METRIC_PREFIX
public static final java.lang.String ROUTER_SERVICE_METRIC_PREFIX
- See Also:
- Constant Field Values
-
ROUTER_SERVICE_METRIC_ENTITIES
public static final java.util.Collection<MetricEntity> ROUTER_SERVICE_METRIC_ENTITIES
-
-
Constructor Detail
-
RouterServer
public RouterServer(VeniceProperties properties, java.util.List<ServiceDiscoveryAnnouncer> serviceDiscoveryAnnouncers, java.util.Optional<DynamicAccessController> accessController, java.util.Optional<SSLFactory> sslFactory)
-
RouterServer
public RouterServer(VeniceProperties properties, java.util.List<ServiceDiscoveryAnnouncer> serviceDiscoveryAnnouncers, java.util.Optional<DynamicAccessController> accessController, java.util.Optional<SSLFactory> sslFactory, io.tehuti.metrics.MetricsRepository metricsRepository)
-
RouterServer
public RouterServer(VeniceProperties properties, java.util.List<ServiceDiscoveryAnnouncer> serviceDiscoveryAnnouncers, java.util.Optional<DynamicAccessController> accessController, java.util.Optional<SSLFactory> sslFactory, io.tehuti.metrics.MetricsRepository metricsRepository, com.linkedin.d2.balancer.D2Client d2Client, java.lang.String d2ServiceName)
-
RouterServer
public RouterServer(VeniceProperties properties, HelixCustomizedViewOfflinePushRepository routingDataRepository, java.util.Optional<HelixHybridStoreQuotaRepository> hybridStoreQuotaRepository, HelixReadOnlyStoreRepository metadataRepository, HelixReadOnlySchemaRepository schemaRepository, HelixReadOnlyStoreConfigRepository storeConfigRepository, java.util.List<ServiceDiscoveryAnnouncer> serviceDiscoveryAnnouncers, java.util.Optional<SSLFactory> sslFactory, HelixLiveInstanceMonitor liveInstanceMonitor)
Only use this constructor for testing when you want to pass mock repositories Having separate constructors just for tests is hard to maintain, especially since in this case, the test constructor does not initialize manager...
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
run
public static void run(java.lang.String routerConfigFilePath, boolean runForever) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getMetricsRepository
public io.tehuti.metrics.MetricsRepository getMetricsRepository()
-
startInner
public boolean startInner() throws java.lang.Exception
- Specified by:
startInner
in classAbstractVeniceService
- Returns:
- true if the service is completely started,
false if it is still starting asynchronously (in this case, it is the implementer's
responsibility to set
AbstractVeniceService.serviceState
toAbstractVeniceService.ServiceState.STARTED
upon completion of the async work). - Throws:
java.lang.Exception
-
addOptionalChannelHandler
public void addOptionalChannelHandler(java.lang.String key, io.netty.channel.ChannelHandler channelHandler)
-
stopInner
public void stopInner() throws java.lang.Exception
- Specified by:
stopInner
in classAbstractVeniceService
- Throws:
java.lang.Exception
-
getRoutingDataRepository
public HelixBaseRoutingRepository getRoutingDataRepository()
-
getMetadataRepository
public ReadOnlyStoreRepository getMetadataRepository()
-
getSchemaRepository
public ReadOnlySchemaRepository getSchemaRepository()
-
getRoutersClusterManager
public ZkRoutersClusterManager getRoutersClusterManager()
-
getConfig
public VeniceRouterConfig getConfig()
-
setReadRequestThrottling
public void setReadRequestThrottling(boolean throttle)
-
refresh
public void refresh()
-
-