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


Java ImmutableList类代码示例

本文整理汇总了Java中org.elasticsearch.common.collect.ImmutableList的典型用法代码示例。如果您正苦于以下问题:Java ImmutableList类的具体用法?Java ImmutableList怎么用?Java ImmutableList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CloudServersDiscovery

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
@Inject
public CloudServersDiscovery(Settings settings, ClusterName clusterName, ThreadPool threadPool, TransportService transportService,
                             ClusterService clusterService, NodeSettingsService nodeSettingsService, DiscoveryNodeService discoveryNodeService,
                             ZenPingService pingService, Version version, DiscoverySettings discoverySettings, CloudServersService cloudServersService) {
    super(settings, clusterName, threadPool, transportService, clusterService, nodeSettingsService, discoveryNodeService, pingService, version, discoverySettings);
    if(settings.getAsBoolean("rackspace.enabled", true)){
        ImmutableList<? extends ZenPing> zenPings = pingService.zenPings();
        UnicastZenPing unicastZenPing = null;
        for(ZenPing zenPing : zenPings){
            if(zenPing instanceof UnicastZenPing){
                unicastZenPing = (UnicastZenPing) zenPing;
                break;
            }
        }

        if(unicastZenPing != null){
            unicastZenPing.addHostsProvider(new CloudServersUnicastHostsProvider(settings, transportService, cloudServersService.context()));
            pingService.zenPings(ImmutableList.<ZenPing>of(unicastZenPing));
        }
        else{
            logger.warn("failed to apply cloud servers unicast discovery. No unicast ping found.");
        }
    }
}
 
开发者ID:jlinn,项目名称:elasticsearch-cloud-rackspace,代码行数:25,代码来源:CloudServersDiscovery.java

示例2: masterOperation

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
@Override
protected void masterOperation(GetRiverStateRequest request, ClusterState state, ActionListener<GetRiverStateResponse> listener) throws ElasticsearchException {
    MetaData metaData = state.metaData();
    RiverStatesMetaData riverStates = metaData.custom(RiverStatesMetaData.TYPE);
    if (request.getRiverName() == null || request.getRiverType() == null) {
        listener.onResponse(new GetRiverStateResponse(request, riverStates.rivers()));
    } else {
        String riverName = request.getRiverName();
        String riverType = request.getRiverType();
        ImmutableList.Builder<RiverState> builder = ImmutableList.builder();
        for (Map.Entry<RiverName, River> entry : RiverHelper.rivers(injector).entrySet()) {
            RiverName name = entry.getKey();
            if (("*".equals(riverName) || name.getName().equals(riverName)) && ("*".equals(riverType) || name.getType().equals(riverType)) && entry.getValue() instanceof StatefulRiver) {
                StatefulRiver river = (StatefulRiver) entry.getValue();
                if (river.getRiverState() != null) {
                    builder.add(river.getRiverState());
                }
            }
        }
        listener.onResponse(new GetRiverStateResponse(request, builder.build()));
    }
}
 
开发者ID:szwork2013,项目名称:elasticsearch-sentiment,代码行数:23,代码来源:TransportGetRiverStateAction.java

示例3: services

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
@Override
public Collection<Class<? extends LifecycleComponent>> services() {

    if (!clientMode) {
        return ImmutableList.<Class<? extends LifecycleComponent>> of(AuditService.class);
    }

    return ImmutableList.<Class<? extends LifecycleComponent>> of();
}
 
开发者ID:salyh,项目名称:elasticsearch-sample-plugin-audit,代码行数:10,代码来源:AuditPlugin.java

示例4: spawnModules

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
@Override
public Iterable<? extends Module> spawnModules() {
    if (!clientMode) {
        return ImmutableList.<Module> of(new AuditActionModule(), new AuditRestModule());
    }

    return ImmutableList.<Module> of(new AuditActionModule());
}
 
开发者ID:salyh,项目名称:elasticsearch-sample-plugin-audit,代码行数:9,代码来源:AuditModule.java

示例5: isESRunning

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
/**
 * Check if elasticsearch server is running
 * @param client
 * @return
 */	
public boolean isESRunning() {
    ImmutableList<DiscoveryNode> nodes = transportClient.connectedNodes();
    if (nodes.isEmpty()) {
    	LOGGER.error("No nodes available. The elasticsearch server my not be running.");
    	return false;
    } else 
        LOGGER.info("Connected to nodes: " + nodes.toString());
    return true;
}
 
开发者ID:dice-group,项目名称:Tapioca,代码行数:15,代码来源:ESEngine.java

示例6: waitForConnected

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
public boolean waitForConnected(long timeout) throws InterruptedException {
  long stopTime = System.currentTimeMillis() + timeout ;
  while(System.currentTimeMillis() < stopTime) {
    ImmutableList<DiscoveryNode> nodes  = client.connectedNodes() ;
    if(!nodes.isEmpty()) return true ;
    Thread.sleep(1000);
  }
  return false ;
}
 
开发者ID:DemandCube,项目名称:NeverwinterDP-Commons,代码行数:10,代码来源:ESClient.java

示例7: add

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
private void add(String name, List<JobEvent> values, JobEvent status) throws IOException {
    String value = generateSetting(ImmutableList.<JobEvent>builder()
            .addAll(values)
            .add(status)
            .build());
    updateSetting(name, value);
}
 
开发者ID:jprante,项目名称:elasticsearch-gatherer,代码行数:8,代码来源:GathererState.java

示例8: parseSetting

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
private List<JobEvent> parseSetting(String value) throws IOException {
    XContentParser parser = xContent(JSON).createParser(value);
    Builder<JobEvent> builder = ImmutableList.builder();
    parser.nextToken();
    while (parser.nextToken() != END_ARRAY) {
        JobEvent status = new JobEvent();
        builder.add(status.fromXContent(parser));
    }
    return builder.build();
}
 
开发者ID:jprante,项目名称:elasticsearch-gatherer,代码行数:11,代码来源:GathererState.java

示例9: readFrom

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    getRiverStateRequest = new GetRiverStateRequest();
    getRiverStateRequest.readFrom(in);
    int len = in.readInt();
    ImmutableList.Builder<RiverState> builder = ImmutableList.builder();
    for (int i = 0; i < len; i++) {
        RiverState rs = new RiverState();
        rs.readFrom(in);
        builder.add(rs);
    }
    states = builder.build();
}
 
开发者ID:szwork2013,项目名称:elasticsearch-sentiment,代码行数:15,代码来源:GetRiverStateResponse.java

示例10: convertList

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
private static ArrayList<TransportAddress> convertList(ImmutableList<DiscoveryNode> list) {
	ArrayList<TransportAddress> nodes = new ArrayList<TransportAddress>();
	for (int pos = 0; pos < list.size(); pos++) {
		nodes.add(list.get(pos).address());
	}
	return nodes;
}
 
开发者ID:hdsdi3g,项目名称:MyDMAM,代码行数:8,代码来源:ElasticsearchStatus.java

示例11: connectedNodes

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
public List<String> connectedNodes() {
    ImmutableList<DiscoveryNode> discoveryNodes = client().connectedNodes();
    List<String> nodes = new ArrayList<String>();
    for (DiscoveryNode discoveryNode : discoveryNodes) {
        TransportAddress address = discoveryNode.address();
        if (address != null) {
            nodes.add(address.toString());
        }
    }
    return nodes;
}
 
开发者ID:javanna,项目名称:elasticshell,代码行数:12,代码来源:TransportClient.java

示例12: modules

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
@Override
public Collection<Class<? extends Module>> modules() {
    return ImmutableList.<Class<? extends Module>> of(AuditModule.class);
}
 
开发者ID:salyh,项目名称:elasticsearch-sample-plugin-audit,代码行数:5,代码来源:AuditPlugin.java

示例13: CopyBitsTo

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
private CopyBitsTo(final ImmutableList<String> copyToFields) {
    copyBitsToFields = copyToFields;
}
 
开发者ID:sherlok,项目名称:sherlastic,代码行数:4,代码来源:SherlokFieldMapper.java

示例14: copyToFields

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
public ImmutableList<String> copyToFields() {
    return copyBitsToFields;
}
 
开发者ID:sherlok,项目名称:sherlastic,代码行数:4,代码来源:SherlokFieldMapper.java

示例15: modules

import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
@Override
public Collection<Class<? extends Module>> modules() {
    return ImmutableList
            .<Class<? extends Module>> of(SherlokAnalysisModule.class);
}
 
开发者ID:sherlok,项目名称:sherlastic,代码行数:6,代码来源:SherlokPlugin.java


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