Java Magazine, Sept/Oct 2018
ORACLE COM JAVAMAGAZINE SEPTEMBER OCTOBER 2018 46 the leading edge commandProperties withExecutionIsolationThreadTimeoutInMilliseconds 1200 config andCommandPropertiesDefaults commandProperties config andThreadPoolPropertiesDefaults HystrixThreadPoolProperties Setter withMaxQueueSize 1 withCoreSize 15 @ Override public Double getLatestPrice String ticker throws Exception PriceCommand pc new PriceCommand priceDelegateImpl ticker restTemplate config Future Double pcFuture pc queue return pcFuture get The goal here is to overwrite the default Hystrix configuration specifically configuring Hystrix to abandon the original request sent to the price service if it takes more than 1200 milliseconds for processing In such a case Hystrix will return the value given by the getFallback method Under the covers Hystrix instantiates and uses a thread pool of 10 threads that is assigned to each command type the user had defined In my case I have only one Hystrix command PriceCommand so by default my command will execute on one thread pool of 10 threads A little later in the article I discuss what happens when I use the default settings but for now I will refer to Hystrix documentation to size my thread pool correctly
You must have JavaScript enabled to view digital editions.