private void updateRenewalThreshold() {
        try {
            Applications apps = eurekaClient.getApplications();
            int count = 0;
            for (Application app : apps.getRegisteredApplications()) {
                for (InstanceInfo instance : app.getInstances()) {
                    if (this.isRegisterable(instance)) {
                        ++count;
                    }
                }
            }
            synchronized (lock) {
                // Update threshold only if the threshold is greater than the
                // current expected threshold or if self preservation is disabled.
                if ((count) > (serverConfig.getRenewalPercentThreshold() * expectedNumberOfClientsSendingRenews)
                        || (!this.isSelfPreservationModeEnabled())) {
                    this.expectedNumberOfClientsSendingRenews = count;
                    updateRenewsPerMinThreshold();
                }
            }
            logger.info("Current renewal threshold is : {}", numberOfRenewsPerMinThreshold);
        } catch (Throwable e) {
            logger.error("Cannot update renewal threshold", e);
        }
    }
private void updateRenewalThreshold ( ) { try { Applications apps = eurekaClient . getApplications ( ) ; int count = 0 ; for ( Application app : apps . getRegisteredApplications ( ) ) { for ( InstanceInfo instance : app . getInstances ( ) ) { if ( this . isRegisterable ( instance ) ) { ++ count ; } } } synchronized ( lock ) { if ( ( count ) > ( serverConfig . getRenewalPercentThreshold ( ) * expectedNumberOfClientsSendingRenews ) || ( ! this . isSelfPreservationModeEnabled ( ) ) ) { this . expectedNumberOfClientsSendingRenews = count ; updateRenewsPerMinThreshold ( ) ; } } logger . info ( "Current renewal threshold is : {}" , numberOfRenewsPerMinThreshold ) ; } catch ( Throwable e ) { logger . error ( "Cannot update renewal threshold" , e ) ; } }
Updates the <em>renewal threshold</em> based on the current number of
renewals. The threshold is a percentage as specified in
{@link EurekaServerConfig#getRenewalPercentThreshold()} of renewals
received per minute {@link #getNumOfRenewsInLastMin()}.