public SourcedEurekaRegistryImpl(EurekaRegistryMetricFactory metricsFactory, Scheduler scheduler) { this(new IndexRegistryImpl<InstanceInfo>(), metricsFactory, scheduler); }
@Override public String toString() { return prettyString(); }
public SourcedEurekaRegistryImpl(EurekaRegistryMetricFactory metricsFactory) { this(new IndexRegistryImpl<InstanceInfo>(), metricsFactory, Schedulers.computation()); }
@Inject public EurekaClientRegistryImpl(EurekaClientRegistryMetrics metrics) { this.metrics = metrics; this.metrics.setRegistrySizeMonitor(new Callable<Integer>() { @Override public Integer call() throws Exception { return internalStore.size(); } }); internalStore = new ConcurrentHashMap<>(); indexRegistry = new IndexRegistryImpl<>(); notificationSubject = NotificationsSubject.create(); }
@Override protected EurekaInterestClient buildClient() { if (serverResolver == null) { throw new IllegalArgumentException("Cannot build client for discovery without read server resolver"); } if(clientId == null) { clientId = INTEREST_CLIENT_ID; } BatchingRegistry<InstanceInfo> remoteBatchingRegistry = new BatchingRegistryImpl<>(); BatchAwareIndexRegistry<InstanceInfo> indexRegistry = new BatchAwareIndexRegistry<>( new IndexRegistryImpl<InstanceInfo>(), remoteBatchingRegistry); PreservableEurekaRegistry registry = new PreservableEurekaRegistry( new SourcedEurekaRegistryImpl(indexRegistry, registryMetricFactory), registryConfig, registryMetricFactory); ClientChannelFactory<InterestChannel> channelFactory = new InterestChannelFactory(clientId, transportConfig, serverResolver, registry, remoteBatchingRegistry, clientMetricFactory); return new EurekaInterestClientImpl(registry, channelFactory); } }
public EurekaServerRegistryImpl(WriteServerMetricFactory metricsFactory, Scheduler scheduler) { this.metrics = metricsFactory.getEurekaServerRegistryMetrics(); this.metrics.setRegistrySizeMonitor(this); invoker = new NotificationTaskInvoker( metricsFactory.getRegistryTaskInvokerMetrics(), scheduler); internalStore = new ConcurrentHashMap<>(); indexRegistry = new IndexRegistryImpl<>(); notificationSubject = NotificationsSubject.create(); internalStoreAccessor = new MultiSourcedDataHolder.HolderStoreAccessor<NotifyingInstanceInfoHolder>() { @Override public void add(NotifyingInstanceInfoHolder holder) { internalStore.put(holder.getId(), holder); } @Override public NotifyingInstanceInfoHolder get(String id) { return internalStore.get(id); } @Override public void remove(String id) { internalStore.remove(id); } @Override public boolean contains(String id) { return internalStore.containsKey(id); } }; }
new IndexRegistryImpl<InstanceInfo>(), remoteBatchingRegistry);