當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。