本文整理匯總了Java中com.netflix.hystrix.HystrixCommandProperties.defaultSetter方法的典型用法代碼示例。如果您正苦於以下問題:Java HystrixCommandProperties.defaultSetter方法的具體用法?Java HystrixCommandProperties.defaultSetter怎麽用?Java HystrixCommandProperties.defaultSetter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.netflix.hystrix.HystrixCommandProperties
的用法示例。
在下文中一共展示了HystrixCommandProperties.defaultSetter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shouldIncrementCounterHistogramForExecuteButNotLatencyOnCancelledCommand
import com.netflix.hystrix.HystrixCommandProperties; //導入方法依賴的package包/類
@Test
public void shouldIncrementCounterHistogramForExecuteButNotLatencyOnCancelledCommand() {
// given
HystrixCommandProperties.Setter commandProperties = HystrixCommandProperties.defaultSetter();
TestHystrixCommand command = new TestHystrixCommand("cancelledCommand",
commandProperties).willWait(10);
command.queue().cancel(true);
// then
assertThat(CollectorRegistry.defaultRegistry.getSampleValue(
"exampleapp_hystrix_command_latency_execute_seconds_count",
new String[]{"command_group", "command_name"},
new String[]{"group_cancelledCommand", "command_cancelledCommand"}
))
.describedAs("counter of all executions in the histogram")
.isEqualTo(1);
assertThat(CollectorRegistry.defaultRegistry.getSampleValue(
"exampleapp_hystrix_command_latency_total_seconds_count",
new String[]{"command_group", "command_name"},
new String[]{"group_cancelledCommand", "command_cancelledCommand"}
))
.describedAs("counter of all executions in the histogram")
.isEqualTo(0);
}
示例2: commandProperties
import com.netflix.hystrix.HystrixCommandProperties; //導入方法依賴的package包/類
private HystrixCommandProperties.Setter commandProperties() {
CircuitBreakerProperty[] properties = onCircuitBreaker.map(a -> a.properties())
.orElseGet(() -> new CircuitBreakerProperty[0]);
HystrixCommandProperties.Setter hystrixCommandProperties = HystrixCommandProperties.defaultSetter();
HystrixCircuitBreakerCommandPropertiesSetter propertiesSetter = new HystrixCircuitBreakerCommandPropertiesSetter(properties);
propertiesSetter.applyTo(hystrixCommandProperties);
return hystrixCommandProperties;
}