當前位置: 首頁>>代碼示例>>Java>>正文


Java HystrixCommandProperties.defaultSetter方法代碼示例

本文整理匯總了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);
}
 
開發者ID:ahus1,項目名稱:prometheus-hystrix,代碼行數:27,代碼來源:HystrixCommandTest.java

示例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;
}
 
開發者ID:ljtfreitas,項目名稱:java-restify,代碼行數:12,代碼來源:HystrixCommandMetadataFactory.java


注:本文中的com.netflix.hystrix.HystrixCommandProperties.defaultSetter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。