本文整理汇总了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.");
}
}
}
示例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()));
}
}
示例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();
}
示例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());
}
示例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;
}
示例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 ;
}
示例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);
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例12: modules
import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
@Override
public Collection<Class<? extends Module>> modules() {
return ImmutableList.<Class<? extends Module>> of(AuditModule.class);
}
示例13: CopyBitsTo
import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
private CopyBitsTo(final ImmutableList<String> copyToFields) {
copyBitsToFields = copyToFields;
}
示例14: copyToFields
import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
public ImmutableList<String> copyToFields() {
return copyBitsToFields;
}
示例15: modules
import org.elasticsearch.common.collect.ImmutableList; //导入依赖的package包/类
@Override
public Collection<Class<? extends Module>> modules() {
return ImmutableList
.<Class<? extends Module>> of(SherlokAnalysisModule.class);
}