@Override public int size() { return eurekaRegistry.size(); }
@Override public void call(Boolean status) { if (status) { expectedRegistrySize = Math.max(expectedRegistrySize, eurekaRegistry.size()); resumeEviction(); } } };
/** * FIXME eviction strategies need a rethink * >= 0 as when both sizes are equal, we still allow eviction to happen as they may be stale copies */ private boolean allowedToEvict() { boolean allowed = evictionStrategy.allowedToEvict(expectedRegistrySize, eurekaRegistry.size()) >= 0; // TODO We decided that self preservation should not trigger component DOWN transition. Health check from PreservableEurekaRegistry might be not needed // moveHealthTo(allowed ? Status.UP : Status.DOWN); return allowed; }
@Override public Observable<Void> call(final ReplicationChannel replicationChannel) { return replicationChannel.hello(new ReplicationHello(ownInstanceId, registry.size())) .take(1) .map(new Func1<ReplicationHelloReply, ReplicationChannel>() { @Override public ReplicationChannel call(ReplicationHelloReply replicationHelloReply) { if (replicationHelloReply.getSourceId().equals(ownInstanceId)) { logger.info("{}: Taking out replication connection to itself", ownInstanceId); replicationChannel.close(); // gracefully close return null; } else { logger.info("{} received hello back from {}", ownInstanceId, replicationHelloReply.getSourceId()); return replicationChannel; } } }) .filter(new Func1<ReplicationChannel, Boolean>() { @Override public Boolean call(ReplicationChannel channel) { return channel != null; } }) .concatMap(new ReplicateFunc(registry)); } });
@Override public WriteServerReport serverReport() { return new WriteServerReport( getRegistrationPort(), getDiscoveryPort(), getReplicationPort(), getEurekaServerRegistry().size(), getHttpServerPort(), getWebAdminPort() ); }