@Test public void testUnhealthyStatusWithStoppingComponent() { CacheImpl<Object, Object> cache = spy(new CacheImpl<>("test")); doReturn(ComponentStatus.STOPPING).when(cache).getStatus(); CacheHealth cacheHealth = new CacheHealthImpl(cache); HealthStatus status = cacheHealth.getStatus(); assertEquals(status, HealthStatus.DEGRADED); }
@Override public HealthStatus getStatus() { if (!isComponentHealthy() || cache.getAdvancedCache().getAvailability() == AvailabilityMode.DEGRADED_MODE) { return HealthStatus.DEGRADED; } DistributionManager distributionManager = SecurityActions.getDistributionManager(cache); if (distributionManager != null && distributionManager.isRehashInProgress()) { return HealthStatus.HEALTHY_REBALANCING; } return HealthStatus.HEALTHY; }
CacheHealthImpl implements CacheHealth { @Override public HealthStatus getStatus() { if (!isComponentHealthy() || cache.getAdvancedCache().getAvailability() == AvailabilityMode.DEGRADED_MODE) { return HealthStatus.DEGRADED; } DistributionManager distributionManager = SecurityActions.getDistributionManager(cache); if (distributionManager != null && distributionManager.isRehashInProgress()) { return HealthStatus.HEALTHY_REBALANCING; } return HealthStatus.HEALTHY; } }
CacheHealthImpl implements CacheHealth { @Override public HealthStatus getStatus() { if (!isComponentHealthy() || cache.getAdvancedCache().getAvailability() == AvailabilityMode.DEGRADED_MODE) { return HealthStatus.DEGRADED; } DistributionManager distributionManager = SecurityActions.getDistributionManager(cache); if (distributionManager != null && distributionManager.isRehashInProgress()) { return HealthStatus.HEALTHY_REBALANCING; } return HealthStatus.HEALTHY; } CacheHealthImpl(Cache<?, ?> cache); }
CacheHealthImpl implements CacheHealth { @Override public HealthStatus getStatus() { if (!isComponentHealthy() || cache.getAdvancedCache().getAvailability() == AvailabilityMode.DEGRADED_MODE) { return HealthStatus.DEGRADED; } DistributionManager distributionManager = SecurityActions.getDistributionManager(cache); if (distributionManager != null && distributionManager.isRehashInProgress()) { return HealthStatus.HEALTHY_REBALANCING; } return HealthStatus.HEALTHY; } CacheHealthImpl(Cache<?, ?> cache); @Override String getCacheName(); @Override HealthStatus getStatus(); }
CacheHealthImpl implements CacheHealth { @Override public HealthStatus getStatus() { if (!isComponentHealthy() || cache.getAdvancedCache().getAvailability() == AvailabilityMode.DEGRADED_MODE) { return HealthStatus.DEGRADED; } DistributionManager distributionManager = SecurityActions.getDistributionManager(cache); if (distributionManager != null && distributionManager.isRehashInProgress()) { return HealthStatus.HEALTHY_REBALANCING; } return HealthStatus.HEALTHY; } CacheHealthImpl(Cache<?, ?> cache); @Override String getCacheName(); @Override HealthStatus getStatus();  }