Java Examples for redis.clients.jedis.exceptions.InvalidURIException

The following java examples will help you to understand the usage of redis.clients.jedis.exceptions.InvalidURIException. These source code samples are taken from different open source projects.

Example 1
Project: cachecloud-master  File: BinaryJedis.java View source code
private void initializeClientFromURI(URI uri) {
    if (!JedisURIHelper.isValid(uri)) {
        throw new InvalidURIException(String.format("Cannot open Redis connection due invalid URI. %s", uri.toString()));
    }
    client = new Client(uri.getHost(), uri.getPort());
    String password = JedisURIHelper.getPassword(uri);
    if (password != null) {
        client.auth(password);
        client.getStatusCodeReply();
    }
    int dbIndex = JedisURIHelper.getDBIndex(uri);
    if (dbIndex > 0) {
        client.select(dbIndex);
        client.getStatusCodeReply();
        client.setDb(dbIndex);
    }
}
Example 2
Project: redis-processing-master  File: BinaryJedis.java View source code
private void initializeClientFromURI(URI uri) {
    if (!JedisURIHelper.isValid(uri)) {
        throw new InvalidURIException(String.format("Cannot open Redis connection due invalid URI. %s", uri.toString()));
    }
    client = new Client(uri.getHost(), uri.getPort());
    String password = JedisURIHelper.getPassword(uri);
    if (password != null) {
        client.auth(password);
        client.getStatusCodeReply();
    }
    int dbIndex = JedisURIHelper.getDBIndex(uri);
    if (dbIndex > 0) {
        client.select(dbIndex);
        client.getStatusCodeReply();
        client.setDb(dbIndex);
    }
}
Example 3
Project: jedis-master  File: BinaryJedis.java View source code
private void initializeClientFromURI(URI uri) {
    if (!JedisURIHelper.isValid(uri)) {
        throw new InvalidURIException(String.format("Cannot open Redis connection due invalid URI. %s", uri.toString()));
    }
    client = new Client(uri.getHost(), uri.getPort(), uri.getScheme().equals("rediss"));
    String password = JedisURIHelper.getPassword(uri);
    if (password != null) {
        client.auth(password);
        client.getStatusCodeReply();
    }
    int dbIndex = JedisURIHelper.getDBIndex(uri);
    if (dbIndex > 0) {
        client.select(dbIndex);
        client.getStatusCodeReply();
        client.setDb(dbIndex);
    }
}