@Override public Observable<InstanceInfo> resolve() { return delegate.resolve(); } }
@PostConstruct @Override public void init() { super.init(); }
@Override public InterestChannel newInterestChannel() { TestableInterestChannel interestChannel = new TestableInterestChannel(); interestChannels.add(interestChannel); return interestChannel; }
@Inject public DashboardServerSelfInfoResolver(final EurekaCommonConfig config, final WebSocketServer webSocketServer) { SelfInfoResolverChain resolverChain = new SelfInfoResolverChain( new ConfigSelfInfoResolver(config), // dashboard server specific resolver new ChainableSelfInfoResolver(Observable.just(new HashSet<ServicePort>()) .map(new Func1<HashSet<ServicePort>, Builder>() { @Override public InstanceInfo.Builder call(HashSet<ServicePort> ports) { ports.add(new ServicePort(WEB_SOCKET_SERVICE, webSocketServer.serverPort(), false)); return new InstanceInfo.Builder().withPorts(ports); } }) ), new PeriodicDataCenterInfoResolver(config), // TODO override with more meaningful health check new ChainableSelfInfoResolver(Observable.just(new InstanceInfo.Builder().withStatus(InstanceInfo.Status.UP))) ); this.delegate = new CachingSelfInfoResolver(resolverChain); }
@Override public Observable<InstanceInfo> resolve() { return resolveMutable().map(new Func1<InstanceInfo.Builder, InstanceInfo>() { @Override public InstanceInfo call(InstanceInfo.Builder builder) { return builder.build(); } }); }
@Override public Observable<InstanceInfo> resolve() { if (connected.compareAndSet(false, true)) { return connect(); } return replaySubject; }
@Override public Observable<InstanceInfo> resolve() { if (connected.compareAndSet(false, true)) { return connect(); } return replaySubject; }
@Override public RegistrationChannel newRegistrationChannel() { TestableRegistrationChannel registrationChannel = new TestableRegistrationChannel(); registrationChannels.add(registrationChannel); return registrationChannel; }
@Override public Observable<InstanceInfo> resolve() { if (connected.compareAndSet(false, true)) { return connect(); } return replaySubject; }
@PostConstruct public void addToLocalRegistry() { resolve().subscribe(new Action1<InstanceInfo>() { @Override public void call(InstanceInfo instanceInfo) { logger.info("Self registration with instance info {}", instanceInfo); eurekaRegistry.register(instanceInfo); } }); }
@PostConstruct public void addToLocalRegistry() { resolve().subscribe(new Action1<InstanceInfo>() { @Override public void call(InstanceInfo instanceInfo) { logger.info("Self registration with instance info {}", instanceInfo); eurekaRegistry.register(instanceInfo); } }); }
public SelfInfoResolverChain(ChainableSelfInfoResolver... resolvers) { super(Observable.combineLatest(getObservableList(resolvers), new FuncN<InstanceInfo.Builder>() { @Override public InstanceInfo.Builder call(Object... args) { InstanceInfo.Builder seed = new InstanceInfo.Builder(); for (Object obj : args) { InstanceInfo.Builder builder = (InstanceInfo.Builder) obj; seed.withBuilder(new InstanceInfo.Builder().withBuilder(builder)); // clone at each step } return seed; } }) ); }
@Override public void call() { logger.info("Eureka server shutdown requested."); logger.info("Unregistering itself from the registry..."); selfRegistrationService.shutdown(); logger.info("Shutting down service container..."); lifecycleManager.close(); } });
@Inject public EurekaBridgeServerSelfInfoResolver( final EurekaServerConfig config, final TcpDiscoveryServer discoveryServer) { SelfInfoResolverChain resolverChain = new SelfInfoResolverChain( new ConfigSelfInfoResolver(config), // read server specific resolver new ChainableSelfInfoResolver(Observable.just(new HashSet<ServicePort>()) .map(new Func1<HashSet<ServicePort>, InstanceInfo.Builder>() { @Override public InstanceInfo.Builder call(HashSet<ServicePort> ports) { ports.add(new ServicePort(Names.DISCOVERY, discoveryServer.serverPort(), false)); return new InstanceInfo.Builder().withPorts(ports); } }) ), new PeriodicDataCenterInfoResolver(config), // TODO override with more meaningful health check new ChainableSelfInfoResolver(Observable.just(new InstanceInfo.Builder().withStatus(InstanceInfo.Status.UP))) ); delegate = new CachingSelfInfoResolver(resolverChain); }
@Override public Observable<InstanceInfo> resolve() { return delegate.resolve(); } }
@PostConstruct @Override public void init() { super.init(); }
protected static List<Observable<InstanceInfo.Builder>> getObservableList(ChainableSelfInfoResolver... resolvers) { List<Observable<InstanceInfo.Builder>> observableList = new ArrayList<>(); for (ChainableSelfInfoResolver resolver : resolvers) { observableList.add(resolver.resolveMutable()); } return observableList; } }
@Inject public EurekaWriteServerSelfInfoResolver( final EurekaServerConfig config, final EurekaHttpServer httpServer, final TcpRegistrationServer registrationServer, final TcpReplicationServer replicationServer, final TcpDiscoveryServer discoveryServer) { SelfInfoResolverChain resolverChain = new SelfInfoResolverChain( new ConfigSelfInfoResolver(config), // write server specific resolver new ChainableSelfInfoResolver(Observable.just(new HashSet<ServicePort>()) .map(new Func1<HashSet<ServicePort>, InstanceInfo.Builder>() { @Override public InstanceInfo.Builder call(HashSet<ServicePort> ports) { ports.add(new ServicePort(Names.EUREKA_HTTP, httpServer.serverPort(), false)); ports.add(new ServicePort(Names.REGISTRATION, registrationServer.serverPort(), false)); ports.add(new ServicePort(Names.REPLICATION, replicationServer.serverPort(), false)); ports.add(new ServicePort(Names.DISCOVERY, discoveryServer.serverPort(), false)); return new InstanceInfo.Builder().withPorts(ports); } }) ), new PeriodicDataCenterInfoResolver(config), // TODO override with more meaningful health check new ChainableSelfInfoResolver(Observable.just(new InstanceInfo.Builder().withStatus(InstanceInfo.Status.UP))) ); delegate = new CachingSelfInfoResolver(resolverChain); }
@Override public Observable<InstanceInfo> resolve() { return delegate.resolve(); } }
@Override public Observable<InstanceInfo> resolve() { return resolver.resolve(); }