本文整理了Java中io.fabric8.groups.Group.update()
方法的一些代码示例,展示了Group.update()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Group.update()
方法的具体详情如下:
包路径:io.fabric8.groups.Group
类名称:Group
方法名:update
[英]Update the state of this group member. If the state is null, the member will leave the group. This method can be called even if the group is not started, in which case the state will be stored and updated when the group becomes started.
[中]更新此组成员的状态。如果状态为null,则该成员将离开组。即使组未启动,也可以调用此方法,在这种情况下,状态将在组启动时存储和更新。
代码示例来源:origin: io.fabric8/fabric-groups
@Override
public void update(T state) {
this.state = state;
Group<T> group = this.group;
if (group != null) {
group.update(state);
}
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
public void update(T state) {
this.state = state;
Group<T> group = this.group;
if (group != null) {
group.update(state);
}
}
代码示例来源:origin: jboss-fuse/fabric8
public void reSubscribeToZK(){
CamelNodeState state = new CamelNodeState(singletonId);
group.update(state);
}
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
public void groupEvent(Group<QueryNodeState> group, GroupEvent event) {
try {
state.lock.update(new QueryNodeState(queryName, containerName,
state.lock.isMaster() ? new String[]{"stat"} : null));
} catch (IllegalStateException e) {
// not joined ? ignore
}
}
});
代码示例来源:origin: io.fabric8.insight/insight-metrics
@Override
public void groupEvent(Group<QueryNodeState> group, GroupEvent event) {
try {
state.lock.update(new QueryNodeState(queryName, containerName,
state.lock.isMaster() ? new String[]{"stat"} : null));
} catch (IllegalStateException e) {
// not joined ? ignore
}
}
});
代码示例来源:origin: jboss-fuse/fabric8
public void stopServer(Server server) {
// get the server address
String address = getFullAddress(server.getEndpoint().getEndpointInfo().getAddress());
if (LOG.isDebugEnabled()) {
LOG.debug("The CXF server is stopped with address " + address);
}
services.remove(address);
group.update(createState());
}
代码示例来源:origin: jboss-fuse/fabric8
public void startServer(Server server) {
// get the server address
String address = getFullAddress(server.getEndpoint().getEndpointInfo().getAddress());
if (LOG.isDebugEnabled()) {
LOG.debug("The CXF server is start with address " + address);
}
boolean exists = false;
for (String uri : services) {
if (uri.compareTo(address) == 0) {
exists = true;
break;
}
}
if (!exists) {
services.add(address);
}
group.update(createState());
}
代码示例来源:origin: io.fabric8/fabric-camel
public void start() throws Exception {
factory = ManagedGroupFactoryBuilder.create(curator, getClass().getClassLoader(), this);
group = factory.createGroup("/fabric/camel-clusters/" + groupName, CamelNodeState.class);
group.update(createState());
group.add(this);
group.start();
info("Camel context %s is waiting to become the master", groupName);
}
代码示例来源:origin: jboss-fuse/fabric8
public void start() throws Exception {
factory = ManagedGroupFactoryBuilder.create(curator, getClass().getClassLoader(), this);
group = factory.createGroup("/fabric/camel-clusters/" + groupName, CamelNodeState.class);
group.update(createState());
group.add(this);
group.start();
info("Camel context %s is waiting to become the master", groupName);
}
代码示例来源:origin: jboss-fuse/fabric8
public void useCurator(CuratorFramework curator) {
Group<T> group = this.group;
if (group != null) {
closeQuietly(group);
}
if (curator != null) {
group = createGroup(curator, path, clazz);
group.update(state);
for (GroupListener<T> listener : listeners) {
group.add(listener);
}
if (started.get()) {
group.start();
}
this.group = group;
}
}
代码示例来源:origin: io.fabric8/fabric-camel
@Override
protected void doStart() throws Exception {
super.doStart();
singleton.start();
LOG.debug("Attempting to become master for endpoint: " + endpoint + " in " + endpoint.getCamelContext() + " with singletonID: " + endpoint.getSingletonId());
singleton.update(createNodeState());
}
代码示例来源:origin: jboss-fuse/fabric8
protected void onLockOwned() {
if (delegate == null) {
try {
delegate = endpoint.getChildEndpoint().createConsumer(processor);
delegateService = null;
if (delegate instanceof SuspendableService) {
delegateService = (SuspendableService) delegate;
}
// Lets show we are starting the consumer.
CamelNodeState nodeState = createNodeState();
nodeState.started = true;
singleton.update(nodeState);
ServiceHelper.startService(delegate);
} catch (Exception e) {
LOG.error("Failed to start master consumer for: " + endpoint + ". Reason: " + e, e);
}
}
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
protected void doStart() throws Exception {
super.doStart();
singleton.start();
LOG.debug("Attempting to become master for endpoint: " + endpoint + " in " + endpoint.getCamelContext() + " with singletonID: " + endpoint.getSingletonId());
singleton.update(createNodeState());
}
代码示例来源:origin: io.fabric8.insight/insight-elasticsearch-discovery
@Override
public CuratorFramework addingService(ServiceReference<CuratorFramework> reference) {
CuratorFramework curator = context.getService(reference);
try {
logger.debug("CuratorFramework found, starting group");
GroupFactory factory = new ZooKeeperGroupFactory(curator);
singleton = factory.createGroup("/fabric/registry/clusters/elasticsearch/" + clusterName.value(), ESNode.class);
singleton.add(this);
singleton.update(new ESNode(clusterName.value(), localNode, false));
singleton.start();
} catch (Exception e) {
LOG.error("Error starting group", e);
}
return curator;
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
public CuratorFramework addingService(ServiceReference<CuratorFramework> reference) {
CuratorFramework curator = context.getService(reference);
try {
logger.debug("CuratorFramework found, starting group");
GroupFactory factory = new ZooKeeperGroupFactory(curator);
singleton = factory.createGroup("/fabric/registry/clusters/elasticsearch/" + clusterName.value(), ESNode.class);
singleton.add(this);
singleton.update(new ESNode(clusterName.value(), localNode, false));
singleton.start();
} catch (Exception e) {
LOG.error("Error starting group", e);
}
return curator;
}
代码示例来源:origin: io.fabric8/fabric-openshift
@Activate
void activate(Map<String, ?> configuration) {
//this.realm = properties != null && properties.containsKey(REALM_PROPERTY_NAME) ? properties.get(REALM_PROPERTY_NAME) : DEFAULT_REALM;
//this.role = properties != null && properties.containsKey(ROLE_PROPERTY_NAME) ? properties.get(ROLE_PROPERTY_NAME) : DEFAULT_ROLE;
group = new ZooKeeperGroup(curator.get(), ZkPath.OPENSHIFT.getPath(), ControllerNode.class);
group.add(this);
group.update(createState());
group.start();
activateComponent();
}
代码示例来源:origin: io.fabric8.insight/insight-elasticsearch
@Override
public CuratorFramework addingService(ServiceReference<CuratorFramework> reference) {
CuratorFramework curator = context.getService(reference);
try {
logger.debug("CuratorFramework found, starting group");
GroupFactory factory = new ZooKeeperGroupFactory(curator);
singleton = factory.createGroup("/fabric/registry/clusters/elasticsearch/" + clusterName.value(), ESNode.class);
singleton.add(this);
singleton.update(new ESNode(clusterName.value(), localNode, false));
singleton.start();
} catch (Exception e) {
LOG.error("Error starting group", e);
}
return curator;
}
代码示例来源:origin: jboss-fuse/fabric8
@Activate
void activate() {
CuratorFramework curator = this.curator.get();
enableMasterZkCache(curator);
group = new ZooKeeperGroup<AutoScalerNode>(curator, ZkPath.AUTO_SCALE_CLUSTER.getPath(), AutoScalerNode.class);
group.add(this);
group.update(createState());
group.start();
activateComponent();
}
代码示例来源:origin: io.fabric8/fabric-git-server
@Activate
void activate(Map<String, ?> configuration) throws Exception {
RuntimeProperties sysprops = runtimeProperties.get();
realm = getConfiguredRealm(sysprops, configuration);
role = getConfiguredRole(sysprops, configuration);
dataPath = sysprops.getDataPath();
activateComponent();
group = new ZooKeeperGroup<GitNode>(curator.get(), ZkPath.GIT.getPath(), GitNode.class);
group.add(this);
group.update(createState());
group.start();
}
代码示例来源:origin: jboss-fuse/fabric8
@Activate
void activate(Map<String, ?> configuration) throws Exception {
RuntimeProperties sysprops = runtimeProperties.get();
realm = getConfiguredRealm(sysprops, configuration);
roles = getConfiguredRoles(sysprops, configuration);
dataPath = sysprops.getDataPath();
activateComponent();
group = new ZooKeeperGroup<GitNode>(curator.get(), ZkPath.GIT.getPath(), GitNode.class, new NamedThreadFactory("zkgroup-git-httpreg"));
//if anything went wrong in a previous deactivation we still have to clean up the registry
zkCleanUp(group);
group.add(this);
group.update(createState());
group.start();
}
内容来源于网络,如有侵权,请联系作者删除!