configuration
When referencing the Eureka dependency, there is already a ribbon inside it, so you don’t need to refer to it separately
call
The flow chart
The entrance
The relevant code
If you’re interested, check this out:www.codingsky.com/doc/2020/6/…
debug
All the way to track
Check it every 10 seconds
Logic related to ping service status of scheduled task
com.netflix.loadbalancer.BaseLoadBalancer.Pinger#runPinger
Copy the code
Get service registration information from Eureka
How does the Ribbon update Eureka’s service? Look down
The processing logic is updated every 30 seconds
public synchronized void start(final UpdateAction updateAction) { if (isActive.compareAndSet(false, true)) { final Runnable wrapperRunnable = new Runnable() { @Override public void run() { if (! isActive.get()) { if (scheduledFuture ! = null) { scheduledFuture.cancel(true); } return; } try { updateAction.doUpdate(); lastUpdated = System.currentTimeMillis(); } catch (Exception e) { logger.warn("Failed one update cycle", e); }}}; scheduledFuture = getRefreshExecutor().scheduleWithFixedDelay( wrapperRunnable, initialDelayMs, refreshIntervalMs, TimeUnit.MILLISECONDS ); } else { logger.info("Already active, no-op"); }}Copy the code
Afterword.
Here is the main process analysis completed, there may be deficiencies, ha ha ha. Stay tuned for the next installment of Feign!