@Override protected int getEurekaWebAdminPort() { return config.getWebAdminPort(); }
@Inject public EurekaHttpServer(EurekaCommonConfig config) { this.proxy = new RxHttpReverseProxy(config.getHttpPort()); }
@Override public Observable<? extends DataCenterInfo> call() { return LocalDataCenterInfo.forDataCenterType(config.getMyDataCenterType()); } }, Schedulers.io());
@Override public InstanceInfo.Builder call(DataCenterInfo dataCenterInfo) { final String instanceId = config.getAppName() + '#' + UUID.randomUUID().toString();; String address = AddressSelector.selectBy().publicIp(true).or().any().returnNameOrIp(dataCenterInfo.getAddresses()); HashSet<String> healthCheckUrls = new HashSet<>(); healthCheckUrls.add("http://" + address + ':' + config.getWebAdminPort() + "/healthcheck"); return new InstanceInfo.Builder() .withId(instanceId) .withApp(config.getAppName()) .withVipAddress(config.getVipAddress()) .withHealthCheckUrls(healthCheckUrls) .withDataCenterInfo(dataCenterInfo) .withStatus(InstanceInfo.Status.STARTING); } })
@Inject public EurekaShutdownService(EurekaCommonConfig config, Injector injector) { this.lifecycleManager = injector.getInstance(LifecycleManager.class); this.selfRegistrationService = injector.getInstance(SelfRegistrationService.class); this.port = config.getShutDownPort(); }
protected void loadInstanceProperties(Properties props) { // TODO Until admin WEB configuration is more flexible we take port of first write server String writeServer = config.getServerList()[0]; Matcher matcher = Pattern.compile("[^:]+:\\d+:(\\d+):\\d+").matcher(writeServer); if (matcher.matches()) { String interestPort = matcher.group(1); props.setProperty(Eureka2InterestClientProviderImpl.CONFIG_DISCOVERY_PORT, interestPort); } } }
final Func0<Observable<? extends DataCenterInfo>> dataCenterInfoFunc, final Scheduler scheduler) { super(Observable.timer(0, config.getDataCenterResolveIntervalSec(), TimeUnit.SECONDS, scheduler) .flatMap(new Func1<Long, Observable<? extends DataCenterInfo>>() { @Override
config.getHeartbeatIntervalMs(), 3, Schedulers.computation() );
protected String formatAdminURI() { return "http://localhost:" + config.getWebAdminPort() + "/admin"; }
public ConfigSelfInfoResolver(final EurekaCommonConfig config) { super(LocalDataCenterInfo.forDataCenterType(config.getMyDataCenterType()) .map(new Func1<DataCenterInfo, InstanceInfo.Builder>() { @Override public InstanceInfo.Builder call(DataCenterInfo dataCenterInfo) { final String instanceId = config.getAppName() + '#' + UUID.randomUUID().toString();; String address = AddressSelector.selectBy().publicIp(true).or().any().returnNameOrIp(dataCenterInfo.getAddresses()); HashSet<String> healthCheckUrls = new HashSet<>(); healthCheckUrls.add("http://" + address + ':' + config.getWebAdminPort() + "/healthcheck"); return new InstanceInfo.Builder() .withId(instanceId) .withApp(config.getAppName()) .withVipAddress(config.getVipAddress()) .withHealthCheckUrls(healthCheckUrls) .withDataCenterInfo(dataCenterInfo) .withStatus(InstanceInfo.Status.STARTING); } }) ); } }
protected void bindConfigurationProvider(LifecycleInjectorBuilder bootstrapBinder) { final Properties props = new Properties(); props.setProperty(AdminResourcesContainer.CONTAINER_LISTEN_PORT, Integer.toString(config.getWebAdminPort())); props.setProperty("netflix.platform.admin.pages.packages", "netflix"); bootstrapBinder.withAdditionalBootstrapModules(new BootstrapModule() { @Override public void configure(BootstrapBinder binder) { binder.bind(PropertiesLoader.class).toInstance(new PropertiesLoader() { @Override public void load() { ConfigurationManager.loadProperties(props); } }); binder.bind(PropertiesInitializer.class).asEagerSingleton(); Builder builder = ArchaiusConfigurationProvider.builder(); builder.withOwnershipPolicy(ConfigurationOwnershipPolicies.ownsAll()); binder.bindConfigurationProvider().toInstance(builder.build()); } }); }
@Override public void configure(BootstrapBinder binder) { if (config == null) { bindConfigurationProvider(binder); } else { // WebAdmin resource uses Archaius singleton ConfigurationManager.getConfigInstance().setProperty( "netflix.platform.admin.resources.port", Integer.toString(config.getWebAdminPort())); } bindMetricsRegistry(binder); binder.include(EurekaHealthStatusModule.class); binder.include(KaryonWebAdminModule.class); binder.include(new AbstractModule() { @Override protected void configure() { bind(EurekaShutdownService.class).asEagerSingleton(); bind(ShutdownDetector.class).toInstance(new ShutdownDetector()); bind(HealthCheckHandler.class).to(KaryonHealthCheckHandler.class).asEagerSingleton(); bind(HealthCheckInvocationStrategy.class).to(SyncHealthCheckInvocationStrategy.class).asEagerSingleton(); } }); binder.include(EurekaHealthStatusModule.class); } });