Examples of ZookeeperFactory


Examples of com.datasift.dropwizard.zookeeper.ZooKeeperFactory

     *
     * @return an {@link HBaseClient}, managed and configured according to the {@code
     *         configuration}.
     */
    public HBaseClient build(final Environment environment, final String name) {
        final ZooKeeperFactory zkFactory = getZookeeper();

        final HBaseClient proxy = new HBaseClientProxy(
                new org.hbase.async.HBaseClient(zkFactory.getQuorumSpec(), zkFactory.getNamespace()));

        // optionally instrument and bound requests for the client
        final HBaseClient client = instrument(boundRequests(proxy), environment.metrics(), name);

        // configure client
View Full Code Here

Examples of com.datasift.dropwizard.zookeeper.ZooKeeperFactory

                    getShutdownGracePeriod());
        }
    }

    static ConsumerConfig toConsumerConfig(final KafkaConsumerFactory factory) {
        final ZooKeeperFactory zookeeper = factory.getZookeeper();
        final Properties props = new Properties();

        props.setProperty("zk.connect",
                zookeeper.getQuorumSpec() + zookeeper.getNamespace());
        props.setProperty("zk.connectiontimeout.ms",
                String.valueOf(zookeeper.getConnectionTimeout().toMilliseconds()));
        props.setProperty("zk.sessiontimeout.ms",
                String.valueOf(zookeeper.getSessionTimeout().toMilliseconds()));
        props.setProperty("groupid",
                factory.getGroup());
        props.setProperty("socket.timeout.ms",
                String.valueOf(factory.getSocketTimeout().toMilliseconds()));
        props.setProperty("socket.receive.buffer",
View Full Code Here

Examples of com.datasift.dropwizard.zookeeper.ZooKeeperFactory

                    getShutdownGracePeriod());
        }
    }

    static ConsumerConfig toConsumerConfig(final KafkaConsumerFactory factory) {
        final ZooKeeperFactory zookeeper = factory.getZookeeper();
        final Properties props = new Properties();

        props.setProperty("zookeeper.connect",
                zookeeper.getQuorumSpec() + zookeeper.getNamespace());
        props.setProperty("zookeeper.connection.timeout.ms",
                String.valueOf(zookeeper.getConnectionTimeout().toMilliseconds()));
        props.setProperty("zookeeper.session.timeout.ms",
                String.valueOf(zookeeper.getSessionTimeout().toMilliseconds()));
        props.setProperty("group.id",
                factory.getGroup());
        props.setProperty("socket.timeout.ms",
                String.valueOf(factory.getSocketTimeout().toMilliseconds()));
        props.setProperty("socket.receive.buffer.bytes",
View Full Code Here

Examples of com.datasift.dropwizard.zookeeper.ZooKeeperFactory

     * @param name the name for the {@link CuratorFramework} instance.
     *
     * @return a {@link CuratorFramework} instance, managed and configured.
     */
    public CuratorFramework build(final Environment environment, final String name) {
        final ZooKeeperFactory factory = getZooKeeperFactory();
        final String namespace = factory.getNamespace();
        final CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
                .zookeeperFactory(new DropwizardConfiguredZooKeeperFactory(environment, name))
                .ensembleProvider(new DropwizardConfiguredEnsembleProvider(factory))
                .connectionTimeoutMs((int) factory.getConnectionTimeout().toMilliseconds())
                .threadFactory(new ThreadFactoryBuilder().setNameFormat(name + "-%d").build())
                .sessionTimeoutMs((int) factory.getSessionTimeout().toMilliseconds())
                .namespace(namespace.startsWith("/") ? namespace.substring(1) : namespace)
                .compressionProvider(getCompressionProvider())
                .retryPolicy(getRetryPolicy())
                .canBeReadOnly(factory.isReadOnly());

        // add optional auth details
        final ZooKeeperFactory.Auth auth = factory.getAuth();
        if (auth != null) {
            builder.authorization(auth.getScheme(), auth.getId().getBytes());
        }

        final CuratorFramework framework = builder.build();
View Full Code Here

Examples of com.datasift.dropwizard.zookeeper.ZooKeeperFactory

        props.setProperty("producer.type", factory.isAsync() ? "async" : "sync");

        final Optional<ZooKeeperFactory> zooKeeperFactory = factory.getZookeeper();
        if (zooKeeperFactory.isPresent()) {
            final ZooKeeperFactory zk = zooKeeperFactory.get();
            props.setProperty("zk.connect", zk.getQuorumSpec() + zk.getNamespace());
        } else {
            final StringBuilder sb = new StringBuilder(10*factory.getBrokers().size());
            for (final ImmutableMap.Entry<Integer, InetSocketAddress> e : factory.getBrokers().entrySet()) {
                final String host = e.getValue().getHostString();
                final int port = e.getValue().getPort() == 0 ? DEFAULT_BROKER_PORT : e.getValue().getPort();
View Full Code Here

Examples of com.datasift.dropwizard.zookeeper.ZooKeeperFactory

     * @return a {@link CuratorFramework} instance, managed and configured according to the {@code
     *         configuration}.
     */
    public CuratorFramework build(final CuratorConfiguration configuration, final String name) {
        final ZooKeeperConfiguration zkConfiguration = configuration.getEnsembleConfiguration();
        final ZooKeeperFactory factory = new ZooKeeperFactory(environment);
        final CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
                .zookeeperFactory(new DropwizardConfiguredZooKeeperFactory(factory, name))
                .ensembleProvider(new DropwizardConfiguredEnsembleProvider(zkConfiguration))
                .connectionTimeoutMs((int) zkConfiguration.getConnectionTimeout().toMilliseconds())
                .threadFactory(new ThreadFactoryBuilder().setNameFormat(name + "-%d").build())
View Full Code Here

Examples of org.apache.curator.utils.ZookeeperFactory

        }
    }

    public CuratorFrameworkImpl(CuratorFrameworkFactory.Builder builder)
    {
        ZookeeperFactory localZookeeperFactory = makeZookeeperFactory(builder.getZookeeperFactory());
        this.client = new CuratorZookeeperClient
        (
            localZookeeperFactory,
            builder.getEnsembleProvider(),
            builder.getSessionTimeoutMs(),
View Full Code Here

Examples of org.apache.curator.utils.ZookeeperFactory

        namespaceFacadeCache = new NamespaceFacadeCache(this);
    }

    private ZookeeperFactory makeZookeeperFactory(final ZookeeperFactory actualZookeeperFactory)
    {
        return new ZookeeperFactory()
        {
            @Override
            public ZooKeeper newZooKeeper(String connectString, int sessionTimeout, Watcher watcher, boolean canBeReadOnly) throws Exception
            {
                ZooKeeper zooKeeper = actualZookeeperFactory.newZooKeeper(connectString, sessionTimeout, watcher, canBeReadOnly);
View Full Code Here

Examples of org.apache.curator.utils.ZookeeperFactory

        }
    }

    public CuratorFrameworkImpl(CuratorFrameworkFactory.Builder builder)
    {
        ZookeeperFactory localZookeeperFactory = makeZookeeperFactory(builder.getZookeeperFactory());
        this.client = new CuratorZookeeperClient
        (
            localZookeeperFactory,
            builder.getEnsembleProvider(),
            builder.getSessionTimeoutMs(),
View Full Code Here

Examples of org.apache.curator.utils.ZookeeperFactory

        namespaceFacadeCache = new NamespaceFacadeCache(this);
    }

    private ZookeeperFactory makeZookeeperFactory(final ZookeeperFactory actualZookeeperFactory)
    {
        return new ZookeeperFactory()
        {
            @Override
            public ZooKeeper newZooKeeper(String connectString, int sessionTimeout, Watcher watcher, boolean canBeReadOnly) throws Exception
            {
                ZooKeeper zooKeeper = actualZookeeperFactory.newZooKeeper(connectString, sessionTimeout, watcher, canBeReadOnly);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.