本文整理汇总了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;
}
示例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));
}
示例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));
}
示例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();
}