2017-11-03 7 views
0

Notwendigkeit, Leistungsschalter für eines der Projekte zu verwenden und mit Hystrix für den Zweck. Aber ein Hystrix-Fallback wird auch nach Timeouts nicht ausgelöst. Bitte helfen Sie, wenn etwas übersehen wurde. Vielen Dank im Voraus.Hystrix-javanica -Hystrix Timeout Fallbacks sind nicht auslösende

https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-javanica

public class TestHystrix { 

@HystrixCommand(fallbackMethod="fallbackCallFunc", 
     commandProperties={ 
       @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "500") 
     }) 
public String callFunc() throws InterruptedException{ 
    Thread.sleep(1050); 
    return "success"; 
} 

public String fallbackCallFunc(){ 
    return "default"; 
} 

public static void main(String[] args) throws InterruptedException { 
    ConfigurationManager.getConfigInstance().setProperty("hystrix.command.callFunc.execution.isolation.thread.timeoutInMilliseconds", "500"); 
    TestHysterix testClass = new TestHysterix(); 
    System.out.println(testClass.callFunc()); 
} 
} 

Antwort