/** * @param client the client * @param path path to watch */ public ZooKeeperGroup(CuratorFramework client, String path, Class<T> clazz) { this(client, path, clazz, Executors.newSingleThreadExecutor(new NamedThreadFactory("ZKGroup"))); }
public synchronized Group getGroup() throws Exception { if (group == null) { group = new ZooKeeperGroup<CxfNodeState>(getCurator(), zkRoot + fabricPath, CxfNodeState.class, new NamedThreadFactory("zkgroup-lb-feature")); group.start(); } return group; }
void activate(BundleContext bundleContext) { executor = Executors.newSingleThreadExecutor(new NamedThreadFactory(getThreadNamePrefix())); bundleContext.addBundleListener(this); activateComponent(); }
private synchronized void initGroup() throws Exception { group = (MultiGroup)factory.createMultiGroup("/fabric/registry/clusters/amq/" + groupName, ActiveMQNode.class, new NamedThreadFactory("zkgroup-fabric-mq-discovery")); group.add(new GroupListener<ActiveMQNode>() { @Override public void groupEvent(Group<ActiveMQNode> group, GroupEvent event) { LOG.debug("Event: " + event); Map<String, ActiveMQNode> masters = new HashMap<String, ActiveMQNode>(); for (ActiveMQNode node : group.members().values()) { if (!masters.containsKey(node.id)) { masters.put(node.id, node); } } update(masters.values()); } }); }
@Activate void activate() throws IOException { activateComponent(); group = new ZooKeeperGroup<GitNode>(curator.get(), ZkPath.GIT.getPath(), GitNode.class, new NamedThreadFactory("zkgroup-gml")); group.add(this); group.start(); }
@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(); }