Java Code Examples for redis.clients.jedis.HostAndPort#getHost()

The following examples show how to use redis.clients.jedis.HostAndPort#getHost() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClusterNodeInformationParser.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
public HostAndPort getHostAndPortFromNodeLine(String[] nodeInfoPartArray, HostAndPort current) {
  String stringHostAndPort = nodeInfoPartArray[HOST_AND_PORT_INDEX];

  String[] arrayHostAndPort = stringHostAndPort.split(":");
  return new HostAndPort(arrayHostAndPort[0].isEmpty() ? current.getHost() : arrayHostAndPort[0],
      arrayHostAndPort[1].isEmpty() ? current.getPort() : Integer.valueOf(arrayHostAndPort[1]));
}
 
Example 2
Source File: JedisSentinelTest.java    From cachecloud with Apache License 2.0 5 votes vote down vote up
private void ensureMonitored(HostAndPort sentinel, String masterName, String ip, int port,
    int quorum) {
  Jedis j = new Jedis(sentinel.getHost(), sentinel.getPort());
  try {
    j.sentinelMonitor(masterName, ip, port, quorum);
  } catch (JedisDataException e) {
  } finally {
    j.close();
  }
}
 
Example 3
Source File: RedisNode.java    From redis-manager with Apache License 2.0 4 votes vote down vote up
public static RedisNode masterRedisNode(HostAndPort hostAndPort) {
    return new RedisNode(hostAndPort.getHost(), hostAndPort.getPort(), NodeRole.MASTER);
}