Package com.lambdaworks.redis

Examples of com.lambdaworks.redis.RedisURI


     *
     * @return Partitions
     */
    protected Partitions loadPartitions() {
        String clusterNodes = null;
        RedisURI nodeUri = null;
        Exception lastException = null;
        for (RedisURI initialUri : initialUris) {

            try {
                RedisAsyncConnectionImpl<String, String> connection = connectAsyncImpl(initialUri.getResolvedAddress());
                nodeUri = initialUri;
                clusterNodes = connection.clusterNodes().get();
                connection.close();
                break;
            } catch (Exception e) {
                lastException = e;
            }

        }

        if (clusterNodes == null) {
            if (lastException == null) {
                throw new RedisException("Cannot retrieve initial cluster partitions from initial URIs " + initialUris);
            }

            throw new RedisException("Cannot retrieve initial cluster partitions from initial URIs " + initialUris,
                    lastException);
        }

        Partitions partitions = ClusterPartitionParser.parse(clusterNodes);

        for (RedisClusterNode partition : partitions) {
            if (partition.getFlags().contains(RedisClusterNode.NodeFlag.MYSELF)) {
                partition.setUri(nodeUri);
            }

            if (nodeUri != null && nodeUri.getPassword() != null) {
                partition.getUri().setPassword(new String(nodeUri.getPassword()));
            }
        }
        return partitions;
    }
View Full Code Here


     *
     * @return Partitions
     */
    protected Partitions loadPartitions() {
        String clusterNodes = null;
        RedisURI nodeUri = null;
        Exception lastException = null;
        for (RedisURI initialUri : initialUris) {

            try {
                RedisAsyncConnectionImpl<String, String> connection = connectAsyncImpl(initialUri.getResolvedAddress());
                nodeUri = initialUri;
                clusterNodes = connection.clusterNodes().get();
                connection.close();
                break;
            } catch (Exception e) {
                lastException = e;
            }

        }

        if (clusterNodes == null) {
            if (lastException == null) {
                throw new RedisException("Cannot retrieve initial cluster partitions from initial URIs " + initialUris);
            }

            throw new RedisException("Cannot retrieve initial cluster partitions from initial URIs " + initialUris,
                    lastException);
        }

        Partitions partitions = ClusterPartitionParser.parse(clusterNodes);

        for (RedisClusterNode partition : partitions) {
            if (partition.getFlags().contains(RedisClusterNode.NodeFlag.MYSELF)) {
                partition.setUri(nodeUri);
            }

            if (nodeUri != null && nodeUri.getPassword() != null) {
                partition.getUri().setPassword(new String(nodeUri.getPassword()));
            }
        }
        return partitions;
    }
View Full Code Here

    @Override
    public RedisClient create(CreationalContext<RedisClient> creationalContext) {

        CreationalContext<RedisURI> uriCreationalContext = beanManager.createCreationalContext(redisURIBean);
        RedisURI redisURI = (RedisURI) beanManager.getReference(redisURIBean, RedisURI.class, uriCreationalContext);

        return new RedisClient(redisURI);
    }
View Full Code Here

    @Override
    public RedisClusterClient create(CreationalContext<RedisClusterClient> creationalContext) {

        CreationalContext<RedisURI> uriCreationalContext = beanManager.createCreationalContext(redisURIBean);
        RedisURI redisURI = (RedisURI) beanManager.getReference(redisURIBean, RedisURI.class, uriCreationalContext);

        return new RedisClusterClient(redisURI);
    }
View Full Code Here

        Iterable<String> split = Splitter.on(' ').split(nodeInformation);
        Iterator<String> iterator = split.iterator();

        String nodeId = iterator.next();
        boolean connected = false;
        RedisURI uri = null;

        HostAndPort hostAndPort = HostAndPort.fromString(iterator.next());

        if (LettuceStrings.isNotEmpty(hostAndPort.getHostText())) {
            uri = RedisURI.Builder.redis(hostAndPort.getHostText(), hostAndPort.getPort()).build();
View Full Code Here

TOP

Related Classes of com.lambdaworks.redis.RedisURI

Copyright © 2018 www.massapicom. 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.