当前位置: 首页>>代码示例>>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;未经允许,请勿转载。