/** * Run the health checks on all current unhealthy end points. This method blocks until the * health checks have completed. */ @VisibleForTesting void forceHealthChecks() { for (HealthCheck healthCheck : _badEndPoints.values()) { healthCheck.run(); } }
@Override public void close() { for (HealthCheck healthCheck : _badEndPoints.values()) { healthCheck.cancel(true); } _hostDiscovery.removeListener(_hostDiscoveryListener); if (_cleanupHostDiscoveryOnClose) { try { _hostDiscovery.close(); } catch (IOException e) { // NOP } } _serviceCache.close(); _metrics.close(); if (_shutdownHealthCheckExecutorOnClose) { _healthCheckExecutor.shutdownNow(); } }
@Override public void close() { for (HealthCheck healthCheck : _badEndPoints.values()) { healthCheck.cancel(true); } _hostDiscovery.removeListener(_hostDiscoveryListener); if (_cleanupHostDiscoveryOnClose) { try { _hostDiscovery.close(); } catch (IOException e) { // NOP } } _serviceCache.close(); _metrics.close(); if (_shutdownHealthCheckExecutorOnClose) { _healthCheckExecutor.shutdownNow(); } }
private synchronized void markEndPointAsBad(ServiceEndPoint endPoint) { if (_recentlyRemovedEndPoints.contains(endPoint)) { // Nothing to do, we've already removed this end point return; } _serviceCache.evict(endPoint); // Only schedule a health check if this is the first time we've seen this end point as bad... HealthCheck healthCheck = new HealthCheck(endPoint); if (_badEndPoints.putIfAbsent(endPoint, healthCheck) == null) { healthCheck.start(); } }
private synchronized void markEndPointAsBad(ServiceEndPoint endPoint) { if (_recentlyRemovedEndPoints.contains(endPoint)) { // Nothing to do, we've already removed this end point return; } _serviceCache.evict(endPoint); // Only schedule a health check if this is the first time we've seen this end point as bad... HealthCheck healthCheck = new HealthCheck(endPoint); if (_badEndPoints.putIfAbsent(endPoint, healthCheck) == null) { healthCheck.start(); } }
/** * Run the health checks on all current unhealthy end points. This method blocks until the * health checks have completed. */ @VisibleForTesting void forceHealthChecks() { for (HealthCheck healthCheck : _badEndPoints.values()) { healthCheck.run(); } }