Search in sources :

Example 1 with TreeCacheExtended

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());
}
Also used : JMXRequest(io.fabric8.api.commands.JMXRequest) TreeCacheExtended(org.apache.curator.framework.recipes.cache.TreeCacheExtended) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 2 with TreeCacheExtended

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();
        }
    }
}
Also used : TcpGateway(io.fabric8.gateway.handlers.tcp.TcpGateway) TreeCacheExtended(org.apache.curator.framework.recipes.cache.TreeCacheExtended)

Example 3 with TreeCacheExtended

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);
    }
}
Also used : TreeCacheExtended(org.apache.curator.framework.recipes.cache.TreeCacheExtended)

Example 4 with TreeCacheExtended

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);
        }
    }
}
Also used : ClientInvokerImpl(io.fabric8.dosgi.tcp.ClientInvokerImpl) ServerInvokerImpl(io.fabric8.dosgi.tcp.ServerInvokerImpl) TreeCacheExtended(org.apache.curator.framework.recipes.cache.TreeCacheExtended) KeeperException(org.apache.zookeeper.KeeperException) ServiceReference(org.osgi.framework.ServiceReference)

Example 5 with TreeCacheExtended

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);
    }
}
Also used : TreeCacheExtended(org.apache.curator.framework.recipes.cache.TreeCacheExtended)

Aggregations

TreeCacheExtended (org.apache.curator.framework.recipes.cache.TreeCacheExtended)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JMXRequest (io.fabric8.api.commands.JMXRequest)1 ClientInvokerImpl (io.fabric8.dosgi.tcp.ClientInvokerImpl)1 ServerInvokerImpl (io.fabric8.dosgi.tcp.ServerInvokerImpl)1 TcpGateway (io.fabric8.gateway.handlers.tcp.TcpGateway)1 KeeperException (org.apache.zookeeper.KeeperException)1 ServiceReference (org.osgi.framework.ServiceReference)1