当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableOpenMap.isEmpty方法代码示例

本文整理汇总了Java中org.elasticsearch.common.collect.ImmutableOpenMap.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableOpenMap.isEmpty方法的具体用法?Java ImmutableOpenMap.isEmpty怎么用?Java ImmutableOpenMap.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.collect.ImmutableOpenMap的用法示例。


在下文中一共展示了ImmutableOpenMap.isEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: earlyTerminate

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
private Decision earlyTerminate(RoutingAllocation allocation, ImmutableOpenMap<String, DiskUsage> usages) {
    // Always allow allocation if the decider is disabled
    if (diskThresholdSettings.isEnabled() == false) {
        return allocation.decision(Decision.YES, NAME, "the disk threshold decider is disabled");
    }

    // Allow allocation regardless if only a single data node is available
    if (allocation.nodes().getDataNodes().size() <= 1) {
        if (logger.isTraceEnabled()) {
            logger.trace("only a single data node is present, allowing allocation");
        }
        return allocation.decision(Decision.YES, NAME, "there is only a single data node present");
    }

    // Fail open there is no info available
    final ClusterInfo clusterInfo = allocation.clusterInfo();
    if (clusterInfo == null) {
        if (logger.isTraceEnabled()) {
            logger.trace("cluster info unavailable for disk threshold decider, allowing allocation.");
        }
        return allocation.decision(Decision.YES, NAME, "the cluster info is unavailable");
    }

    // Fail open if there are no disk usages available
    if (usages.isEmpty()) {
        if (logger.isTraceEnabled()) {
            logger.trace("unable to determine disk usages for disk-aware allocation, allowing allocation");
        }
        return allocation.decision(Decision.YES, NAME, "disk usages are unavailable");
    }
    return null;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:33,代码来源:DiskThresholdDecider.java

示例2: masterOperation

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
@Override
protected void masterOperation(final TypesExistsRequest request, final ClusterState state, final ActionListener<TypesExistsResponse> listener) {
    String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(state, request.indicesOptions(), request.indices());
    if (concreteIndices.length == 0) {
        listener.onResponse(new TypesExistsResponse(false));
        return;
    }

    for (String concreteIndex : concreteIndices) {
        if (!state.metaData().hasConcreteIndex(concreteIndex)) {
            listener.onResponse(new TypesExistsResponse(false));
            return;
        }

        ImmutableOpenMap<String, MappingMetaData> mappings = state.metaData().getIndices().get(concreteIndex).getMappings();
        if (mappings.isEmpty()) {
            listener.onResponse(new TypesExistsResponse(false));
            return;
        }

        for (String type : request.types()) {
            if (!mappings.containsKey(type)) {
                listener.onResponse(new TypesExistsResponse(false));
                return;
            }
        }
    }

    listener.onResponse(new TypesExistsResponse(true));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:31,代码来源:TransportTypesExistsAction.java

示例3: masterOperation

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
@Override
protected void masterOperation(final TypesExistsRequest request, final ClusterState state, final ActionListener<TypesExistsResponse> listener) {
    String[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, request.indicesOptions(), request.indices());
    if (concreteIndices.length == 0) {
        listener.onResponse(new TypesExistsResponse(false));
        return;
    }

    for (String concreteIndex : concreteIndices) {
        if (!state.metaData().hasConcreteIndex(concreteIndex)) {
            listener.onResponse(new TypesExistsResponse(false));
            return;
        }

        ImmutableOpenMap<String, MappingMetaData> mappings = state.metaData().getIndices().get(concreteIndex).getMappings();
        if (mappings.isEmpty()) {
            listener.onResponse(new TypesExistsResponse(false));
            return;
        }

        for (String type : request.types()) {
            if (!mappings.containsKey(type)) {
                listener.onResponse(new TypesExistsResponse(false));
                return;
            }
        }
    }

    listener.onResponse(new TypesExistsResponse(true));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:31,代码来源:TransportTypesExistsAction.java

示例4: mapping

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
/**
 * Gets the mappings for the given schema and table as a formatted json string.
 */
public String mapping(String schema, String table) throws IOException {
  if(USE_EXTERNAL_ES5){
    return "";
  }

  GetMappingsResponse response = getElasticInternalClient().admin().indices().prepareGetMappings(schema).setTypes(table).execute().actionGet();

  XContentBuilder builder = XContentFactory.jsonBuilder();
  builder.prettyPrint().lfAtEnd();

  builder.startObject();
  ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappingsByIndex = response.getMappings();
  if (mappingsByIndex.isEmpty()) {
    return "";
  }

  for (ObjectObjectCursor<String, ImmutableOpenMap<String, MappingMetaData>> indexEntry : mappingsByIndex) {
    if (indexEntry.value.isEmpty()) {
      continue;
    }
    builder.startObject(indexEntry.key, XContentBuilder.FieldCaseConversion.NONE);
    builder.startObject(new XContentBuilderString("mappings"));
    for (ObjectObjectCursor<String, MappingMetaData> typeEntry : indexEntry.value) {
      builder.field(typeEntry.key);
      builder.map(typeEntry.value.sourceAsMap());
    }
    builder.endObject();
    builder.endObject();
  }

  builder.endObject();
  return builder.string();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:37,代码来源:ElasticsearchCluster.java


注:本文中的org.elasticsearch.common.collect.ImmutableOpenMap.isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。