@Test public void testChooseWhenFailure() { SingleServiceLoadBalancer singleLB = newSingleLB(); InstanceInfo first = takeNextOrFail(singleLB); singleLB.recordFailure(first); InstanceInfo healthy = first == INSTANCE_1 ? INSTANCE_2 : INSTANCE_1; assertThat(asList(takeNextOrFail(singleLB), takeNextOrFail(singleLB))).contains(healthy, healthy); testClock.advanceTime(1, TimeUnit.HOURS); assertThat(asList(takeNextOrFail(singleLB), takeNextOrFail(singleLB))).contains(INSTANCE_1, INSTANCE_2); }
public void recordFailure(InstanceInfo instanceInfo) { EurekaInstance eurekaInstance = eurekaInstancesRef.get().get(instanceInfo.getId()); if (eurekaInstance != null) { eurekaInstance.recordFailure(clock.wallTime()); } }
SingleServiceLoadBalancer implements Closeable, EurekaEventListener { public void recordFailure(InstanceInfo instanceInfo) { EurekaInstance eurekaInstance = eurekaInstancesRef.get().get(instanceInfo.getId()); if (eurekaInstance != null) { eurekaInstance.recordFailure(clock.wallTime()); } } }
SingleServiceLoadBalancer implements Closeable, EurekaEventListener { public void recordFailure(InstanceInfo instanceInfo) { EurekaInstance eurekaInstance = eurekaInstancesRef.get().get(instanceInfo.getId()); if (eurekaInstance != null) { eurekaInstance.recordFailure(clock.wallTime()); } } SingleServiceLoadBalancer(EurekaClient eurekaClient,
                                     String vipAddress,
                                     boolean secure,
                                     TitusRuntime titusRuntime); }
SingleServiceLoadBalancer implements Closeable, EurekaEventListener { public void recordFailure(InstanceInfo instanceInfo) { EurekaInstance eurekaInstance = eurekaInstancesRef.get().get(instanceInfo.getId()); if (eurekaInstance != null) { eurekaInstance.recordFailure(clock.wallTime()); } } SingleServiceLoadBalancer(EurekaClient eurekaClient,
                                     String vipAddress,
                                     boolean secure,
                                     TitusRuntime titusRuntime); @Override void close(); @Override void onEvent(EurekaEvent event); Optional<InstanceInfo> chooseNext(); void recordSuccess(InstanceInfo instanceInfo); void recordFailure(InstanceInfo instanceInfo); }
SingleServiceLoadBalancer implements Closeable, EurekaEventListener { public void recordFailure(InstanceInfo instanceInfo) { EurekaInstance eurekaInstance = eurekaInstancesRef.get().get(instanceInfo.getId()); if (eurekaInstance != null) { eurekaInstance.recordFailure(clock.wallTime()); } } SingleServiceLoadBalancer(EurekaClient eurekaClient,
                                     String vipAddress,
                                     boolean secure,
                                     TitusRuntime titusRuntime); @Override void close(); @Override void onEvent(EurekaEvent event); Optional<InstanceInfo> chooseNext(); void recordSuccess(InstanceInfo instanceInfo); void recordFailure(InstanceInfo instanceInfo);  }