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


Java TimeValue.timeValueHours方法代碼示例

本文整理匯總了Java中org.elasticsearch.common.unit.TimeValue.timeValueHours方法的典型用法代碼示例。如果您正苦於以下問題:Java TimeValue.timeValueHours方法的具體用法?Java TimeValue.timeValueHours怎麽用?Java TimeValue.timeValueHours使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.elasticsearch.common.unit.TimeValue的用法示例。


在下文中一共展示了TimeValue.timeValueHours方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testDefaultRecoverAfterTime

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
public void testDefaultRecoverAfterTime() throws IOException {
    // check that the default is not set
    GatewayService service = createService(Settings.builder());
    assertNull(service.recoverAfterTime());

    // ensure default is set when setting expected_nodes
    service = createService(Settings.builder().put("gateway.expected_nodes", 1));
    assertThat(service.recoverAfterTime(), Matchers.equalTo(GatewayService.DEFAULT_RECOVER_AFTER_TIME_IF_EXPECTED_NODES_IS_SET));

    // ensure default is set when setting expected_data_nodes
    service = createService(Settings.builder().put("gateway.expected_data_nodes", 1));
    assertThat(service.recoverAfterTime(), Matchers.equalTo(GatewayService.DEFAULT_RECOVER_AFTER_TIME_IF_EXPECTED_NODES_IS_SET));

    // ensure default is set when setting expected_master_nodes
    service = createService(Settings.builder().put("gateway.expected_master_nodes", 1));
    assertThat(service.recoverAfterTime(), Matchers.equalTo(GatewayService.DEFAULT_RECOVER_AFTER_TIME_IF_EXPECTED_NODES_IS_SET));

    // ensure settings override default
    TimeValue timeValue = TimeValue.timeValueHours(3);
    // ensure default is set when setting expected_nodes
    service = createService(Settings.builder().put("gateway.expected_nodes", 1).put("gateway.recover_after_time", timeValue.toString()));
    assertThat(service.recoverAfterTime().millis(), Matchers.equalTo(timeValue.millis()));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:24,代碼來源:GatewayServiceTests.java

示例2: testMaxAge

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
public void testMaxAge() throws Exception {
    final MaxAgeCondition maxAgeCondition = new MaxAgeCondition(TimeValue.timeValueHours(1));

    long indexCreatedMatch = System.currentTimeMillis() - TimeValue.timeValueMinutes(61).getMillis();
    Condition.Result evaluate = maxAgeCondition.evaluate(new Condition.Stats(0, indexCreatedMatch));
    assertThat(evaluate.condition, equalTo(maxAgeCondition));
    assertThat(evaluate.matched, equalTo(true));

    long indexCreatedNotMatch = System.currentTimeMillis() - TimeValue.timeValueMinutes(59).getMillis();
    evaluate = maxAgeCondition.evaluate(new Condition.Stats(0, indexCreatedNotMatch));
    assertThat(evaluate.condition, equalTo(maxAgeCondition));
    assertThat(evaluate.matched, equalTo(false));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:14,代碼來源:ConditionTests.java

示例3: ClusterHealthResponse

import org.elasticsearch.common.unit.TimeValue; //導入方法依賴的package包/類
/** needed for plugins BWC */
public ClusterHealthResponse(String clusterName, String[] concreteIndices, ClusterState clusterState) {
    this(clusterName, concreteIndices, clusterState, -1, -1, -1, TimeValue.timeValueHours(0));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:5,代碼來源:ClusterHealthResponse.java


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