本文整理了Java中io.fabric8.groups.Group.master()
方法的一些代码示例,展示了Group.master()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Group.master()
方法的具体详情如下:
包路径:io.fabric8.groups.Group
类名称:Group
方法名:master
[英]Retrieve the master node.
[中]检索主节点。
代码示例来源:origin: jboss-fuse/fabric8
@Override
public T master() {
Group<T> group = this.group;
if (group != null) {
return group.master();
} else {
return null;
}
}
代码示例来源:origin: io.fabric8/fabric-groups
@Override
public T master() {
Group<T> group = this.group;
if (group != null) {
return group.master();
} else {
return null;
}
}
代码示例来源:origin: jboss-fuse/fabric8
/**
* Updates the git master url, if needed.
*/
private void updateMasterUrl(Group<GitNode> group) {
GitNode master = group.master();
String masterUrl = master != null ? master.getUrl() : null;
try {
if (masterUrl != null) {
GitService gitservice = gitService.get();
String substitutedUrl = getSubstitutedData(curator.get(), masterUrl);
if (!Strings.isNotBlank(substitutedUrl)) {
LOGGER.warn("Could not render git master URL {}.", masterUrl);
}
//Catch any possible issue indicating that the URL is invalid.
if (!FabricValidations.isURIValid(substitutedUrl)) {
LOGGER.warn("Not changing master Git URL to \"" + substitutedUrl + "\". There may be pending ZK connection shutdown.");
} else {
gitservice.notifyRemoteChanged(substitutedUrl);
}
}
} catch (Exception e) {
LOGGER.error("Failed to point origin to the new master.", e);
}
}
代码示例来源:origin: io.fabric8/fabric-git
/**
* Updates the git master url, if needed.
*/
private void updateMasterUrl(Group<GitNode> group) {
GitNode master = group.master();
String masterUrl = master != null ? master.getUrl() : null;
try {
if (masterUrl != null) {
GitService gitservice = gitService.get();
String substitutedUrl = getSubstitutedData(curator.get(), masterUrl);
if (!Strings.isNotBlank(substitutedUrl)) {
LOGGER.warn("Could not render git master URL {}.", masterUrl);
}
//Catch any possible issue indicating that the URL is invalid.
URIish uri = new URIish(substitutedUrl);
gitservice.notifyRemoteChanged(substitutedUrl);
}
} catch (Exception e) {
LOGGER.error("Failed to point origin to the new master.", e);
}
}
代码示例来源:origin: io.fabric8.insight/insight-elasticsearch-discovery
String master = singleton.master() != null ? singleton.master().node.name() : null;
List<String> slaves = new ArrayList<>();
for (ESNode s : singleton.slaves()) {
} else if (singleton.master() != null) {
DiscoveryNode masterNode = singleton.master().getNode();
try {
代码示例来源:origin: io.fabric8.insight/insight-elasticsearch
String master = singleton.master() != null ? singleton.master().node.name() : null;
List<String> slaves = new ArrayList<String>();
for (ESNode s : singleton.slaves()) {
} else if (singleton.master() != null) {
DiscoveryNode masterNode = singleton.master().getNode();
try {
代码示例来源:origin: jboss-fuse/fabric8
String master = singleton.master() != null ? singleton.master().node.name() : null;
List<String> slaves = new ArrayList<>();
for (ESNode s : singleton.slaves()) {
} else if (singleton.master() != null) {
DiscoveryNode masterNode = singleton.master().getNode();
try {
代码示例来源:origin: io.fabric8.insight/insight-influxdb-metrics
@Override
public synchronized void groupEvent(Group<InfluxDBNode> group, GroupEvent event) {
switch (event) {
case CONNECTED:
InfluxDBNode master = group.master();
if (master != null) {
try {
String url = getSubstitutedData(curator.get(), master.getUrl());
influxDB = InfluxDBFactory.connect(url, "root", "root");
unregister();
registration = bundleContext.registerService(InfluxDB.class, influxDB, null);
} catch (URISyntaxException e) {
throw FabricException.launderThrowable(e);
}
}
case CHANGED:
break;
case DISCONNECTED:
unregister();
}
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
public synchronized void groupEvent(Group<InfluxDBNode> group, GroupEvent event) {
switch (event) {
case CONNECTED:
InfluxDBNode master = group.master();
if (master != null) {
try {
String url = getSubstitutedData(curator.get(), master.getUrl());
influxDB = InfluxDBFactory.connect(url, "root", "root");
unregister();
registration = bundleContext.registerService(InfluxDB.class, influxDB, null);
} catch (URISyntaxException e) {
throw FabricException.launderThrowable(e);
}
}
case CHANGED:
break;
case DISCONNECTED:
unregister();
}
}
代码示例来源:origin: io.fabric8.insight/insight-elasticsearch-discovery
} else {
if (logger.isDebugEnabled()) {
String master = singleton.master() != null ? singleton.master().node.name() : null;
List<String> slaves = new ArrayList<String>();
for (ESNode s : singleton.slaves()) {
代码示例来源:origin: io.fabric8.insight/insight-elasticsearch
} else {
if (logger.isDebugEnabled()) {
String master = singleton.master() != null ? singleton.master().node.name() : null;
List<String> slaves = new ArrayList<String>();
for (ESNode s : singleton.slaves()) {
代码示例来源:origin: jboss-fuse/fabric8
} else {
if (logger.isDebugEnabled()) {
String master = singleton.master() != null ? singleton.master().node.name() : null;
List<String> slaves = new ArrayList<String>();
for (ESNode s : singleton.slaves()) {
代码示例来源:origin: io.fabric8.insight/insight-elasticsearch
@Override
public ClusterState execute(ClusterState currentState) {
// Rebuild state
ClusterState.Builder stateBuilder = ClusterState.builder(currentState);
// Rebuild nodes
DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.builder()
.localNodeId(localNode.id())
.masterNodeId(singleton.master().getNode().id())
.put(singleton.master().getNode());
for (ESNode node : singleton.slaves()) {
nodesBuilder.put(node.getNode());
}
latestDiscoNodes = nodesBuilder.build();
stateBuilder.nodes(latestDiscoNodes);
for (DiscoveryNode node : latestDiscoNodes) {
if (!currentState.nodes().nodeExists(node.id())) {
transportService.connectToNode(node);
}
}
// update the fact that we are the master...
if (!localNode().id().equals(currentState.nodes().masterNodeId())) {
ClusterBlocks clusterBlocks = ClusterBlocks.builder().blocks(currentState.blocks()).removeGlobalBlock(NO_MASTER_BLOCK).build();
stateBuilder.blocks(clusterBlocks);
}
return stateBuilder.build();
}
代码示例来源:origin: io.fabric8.insight/insight-elasticsearch-discovery
@Override
public ClusterState execute(ClusterState currentState) {
// Rebuild state
ClusterState.Builder stateBuilder = ClusterState.builder(currentState);
// Rebuild nodes
DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.builder()
.localNodeId(localNode.id())
.masterNodeId(singleton.master().getNode().id())
.put(singleton.master().getNode());
for (ESNode node : singleton.slaves()) {
nodesBuilder.put(node.getNode());
}
latestDiscoNodes = nodesBuilder.build();
stateBuilder.nodes(latestDiscoNodes);
for (DiscoveryNode node : latestDiscoNodes) {
if (!currentState.nodes().nodeExists(node.id())) {
transportService.connectToNode(node);
}
}
// update the fact that we are the master...
if (!localNode().id().equals(currentState.nodes().masterNodeId())) {
ClusterBlocks clusterBlocks = ClusterBlocks.builder().blocks(currentState.blocks()).removeGlobalBlock(NO_MASTER_BLOCK).build();
stateBuilder.blocks(clusterBlocks);
}
return stateBuilder.build();
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
public ClusterState execute(ClusterState currentState) {
// Rebuild state
ClusterState.Builder stateBuilder = ClusterState.builder(currentState);
// Rebuild nodes
DiscoveryNodes.Builder nodesBuilder = DiscoveryNodes.builder()
.localNodeId(localNode.id())
.masterNodeId(singleton.master().getNode().id())
.put(singleton.master().getNode());
for (ESNode node : singleton.slaves()) {
nodesBuilder.put(node.getNode());
}
latestDiscoNodes = nodesBuilder.build();
stateBuilder.nodes(latestDiscoNodes);
for (DiscoveryNode node : latestDiscoNodes) {
if (!currentState.nodes().nodeExists(node.id())) {
transportService.connectToNode(node);
}
}
// update the fact that we are the master...
if (!localNode().id().equals(currentState.nodes().masterNodeId())) {
ClusterBlocks clusterBlocks = ClusterBlocks.builder().blocks(currentState.blocks()).removeGlobalBlock(NO_MASTER_BLOCK).build();
stateBuilder.blocks(clusterBlocks);
}
return stateBuilder.build();
}
内容来源于网络,如有侵权,请联系作者删除!