Package redis.clients.jedis

Examples of redis.clients.jedis.Jedis.connect()


      public RedisLastAccessRecordWriter() {
        // Create a connection to Redis for each host
        int i = 0;
        for (String host : MRDPUtils.REDIS_INSTANCES) {
          Jedis jedis = new Jedis(host);
          jedis.connect();
          jedisMap.put(i, jedis);
          jedisMap.put(i + 1, jedis);
          i += 2;
        }
      }
View Full Code Here


        // Create a connection to Redis for each host
        // Map an integer 0-(numRedisInstances - 1) to the instance
        int i = 0;
        for (String host : hosts.split(",")) {
          Jedis jedis = new Jedis(host);
          jedis.connect();
          jedisMap.put(i, jedis);
          ++i;
        }
      }
View Full Code Here

      if (usePool && pool != null) {
        return pool.getResource();
      }
      Jedis jedis = new Jedis(getShardInfo());
      // force initialization (see Jedis issue #82)
      jedis.connect();
      return jedis;
    } catch (Exception ex) {
      throw new DataAccessResourceFailureException("Cannot get Jedis connection", ex);
    }
  }
View Full Code Here

  @Override
  public PooledObject<Jedis> makeObject() throws Exception {
    final Jedis jedis = new Jedis(this.host, this.port, this.timeout);

    jedis.connect();
    if (null != this.password) {
      jedis.auth(this.password);
    }
    if (database != 0) {
      jedis.select(database);
View Full Code Here

  private boolean isSentinelAvailable(String node) {
    Jedis jedis = null;
    try {
      String[] hostAndPort = node.split(":");
      jedis = new Jedis(hostAndPort[0], Integer.valueOf(hostAndPort[1]));
      jedis.connect();
      jedis.ping();
      return true;
    }
    catch (Exception ex) {
      return false;
View Full Code Here

     */
    public void cleanRedisDatabase(String host, int port, String password) throws IOException, InterruptedException
    {
        logger.info("flushing db ..........");
        Jedis jedis = new Jedis(host, port);
        jedis.connect();
        if (password != null)
        {
            jedis.auth(password);
        }
        jedis.flushDB();
View Full Code Here

                    : (String) props.get(PersistenceProperties.KUNDERA_PORT);
            String password = RedisPropertyReader.rsmd.getPassword() != null ? RedisPropertyReader.rsmd.getPassword()
                    : (String) props.get(PersistenceProperties.KUNDERA_PASSWORD);
            Jedis connection = new Jedis(contactNode, Integer.valueOf(defaultPort));
            connection.auth(password);
            connection.connect();
            connection.flushDB();
        }
    }

    /**
 
View Full Code Here

                : (String) props.get(PersistenceProperties.KUNDERA_PORT);
        String password = RedisPropertyReader.rsmd.getPassword() != null ? RedisPropertyReader.rsmd.getPassword()
                : (String) props.get(PersistenceProperties.KUNDERA_PASSWORD);
        Jedis connection = new Jedis(contactNode, Integer.valueOf(defaultPort));
        connection.auth(password);
        connection.connect();
        connection.flushDB();
    }
}
View Full Code Here

            if (password != null)
            {
                connection.auth(password);
            }
            connection.connect();
            return connection;
        }
    }

    /**
 
View Full Code Here

    Jedis jedis = null;
    try {

      jedis = new Jedis(node.getHost(), node.getPort());
      jedis.connect();
      jedis.ping();
    } catch (Exception e) {

      return false;
    } finally {
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.