use of org.apache.curator.framework.recipes.cache.TreeCacheExtended in project fabric8 by jboss-fuse.
the class ZkDataStoreImpl method activateInternal.
private void activateInternal() throws Exception {
configCache = new TreeCacheExtended(curator.get(), ZkPath.CONFIGS.getPath(), true, false, true, cacheExecutor);
configCache.start(TreeCacheExtended.StartMode.NORMAL);
configCache.getListenable().addListener(this);
containerCache = new TreeCacheExtended(curator.get(), ZkPath.CONTAINERS.getPath(), true, false, true, cacheExecutor);
containerCache.start(TreeCacheExtended.StartMode.NORMAL);
containerCache.getListenable().addListener(this);
commandsMapper = new ObjectMapper();
commandsMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
commandsMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
// ENTESB-5654: queues to communicate between containers
String name = runtimeProperties.get().getRuntimeIdentity();
commandRequestsQueue = QueueBuilder.builder(curator.get(), new CommandConsumer<>(commandRequests, JMXRequest.class), PublicStringSerializer.serializer(), ZkPath.COMMANDS_REQUESTS.getPath(name)).buildQueue();
commandRequestsQueue.start();
commandResponsesQueue = QueueBuilder.builder(curator.get(), null, PublicStringSerializer.serializer(), ZkPath.COMMANDS_RESPONSES.getPath(name)).buildQueue();
commandResponsesQueue.start();
commandProcessorExecutor.submit(new ZkCommandProcessor());
}
use of org.apache.curator.framework.recipes.cache.TreeCacheExtended in project fabric8 by jboss-fuse.
the class GatewayServiceTreeCache method init.
public void init() throws Exception {
if (active.compareAndSet(false, true)) {
treeCache = new TreeCacheExtended(curator, zkPath, true, false, true, treeCacheExecutor);
treeCache.start(TreeCacheExtended.StartMode.NORMAL);
treeCache.getListenable().addListener(treeListener);
LOG.info("Started a group listener for " + zkPath);
for (TcpGateway gateway : gateways) {
gateway.init();
}
}
}
use of org.apache.curator.framework.recipes.cache.TreeCacheExtended in project fabric8 by jboss-fuse.
the class HttpMappingZooKeeperTreeCache method init.
public void init() throws Exception {
if (active.compareAndSet(false, true)) {
treeCache = new TreeCacheExtended(curator, zooKeeperPath, true, false, true, treeCacheExecutor);
treeCache.start(TreeCacheExtended.StartMode.NORMAL);
treeCache.getListenable().addListener(treeListener);
LOG.info("Started listening to ZK path " + zooKeeperPath);
}
}
use of org.apache.curator.framework.recipes.cache.TreeCacheExtended in project fabric8 by jboss-fuse.
the class Manager method init.
public void init() throws Exception {
// Create client and server
this.client = new ClientInvokerImpl(queue, timeout, serializationStrategies);
this.server = new ServerInvokerImpl(uri, queue, serializationStrategies);
this.client.start();
this.server.start();
// ZooKeeper tracking
try {
create(curator, DOSGI_REGISTRY, CreateMode.PERSISTENT);
} catch (KeeperException.NodeExistsException e) {
// The node already exists, that's fine
}
this.tree = new TreeCacheExtended(curator, DOSGI_REGISTRY, true);
this.tree.getListenable().addListener(this);
this.tree.start();
// UUID
this.uuid = Utils.getUUID(this.bundleContext);
// Service listener filter
String filter = "(" + RemoteConstants.SERVICE_EXPORTED_INTERFACES + "=*)";
// Initialization
this.bundleContext.addServiceListener(this, filter);
// Service registration
this.registration = this.bundleContext.registerService(new String[] { ListenerHook.class.getName(), EventHook.class.getName(), FindHook.class.getName() }, this, null);
// Check existing services
ServiceReference[] references = this.bundleContext.getServiceReferences((String) null, filter);
if (references != null) {
for (ServiceReference reference : references) {
exportService(reference);
}
}
}
use of org.apache.curator.framework.recipes.cache.TreeCacheExtended in project fabric8 by jboss-fuse.
the class GatewayServiceTreeCache method init.
public void init() throws Exception {
if (active.compareAndSet(false, true)) {
treeCache = new TreeCacheExtended(curator, zkPath, true, false, true, treeCacheExecutor);
treeCache.getListenable().addListener(treeListener);
treeCache.start(TreeCacheExtended.StartMode.NORMAL);
LOG.info("Started a group listener for " + zkPath);
}
}
Aggregations