当前位置: 首页>>代码示例>>Java>>正文


Java HostAndPort.getPort方法代码示例

本文整理汇总了Java中redis.clients.jedis.HostAndPort.getPort方法的典型用法代码示例。如果您正苦于以下问题:Java HostAndPort.getPort方法的具体用法?Java HostAndPort.getPort怎么用?Java HostAndPort.getPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在redis.clients.jedis.HostAndPort的用法示例。


在下文中一共展示了HostAndPort.getPort方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateObject

import redis.clients.jedis.HostAndPort; //导入方法依赖的package包/类
@Override
public boolean validateObject(PooledObject<Jedis> pooledJedis) {
    final BinaryJedis jedis = pooledJedis.getObject();
    try {
        HostAndPort hostAndPort = this.hostAndPort.get();
        String connectionHost = jedis.getClient().getHost();
        int connectionPort = jedis.getClient().getPort();

        return hostAndPort.getHost().equals(connectionHost)
                && hostAndPort.getPort() == connectionPort && jedis.isConnected()
                && jedis.ping().equals("PONG");
    } catch (final Exception e) {
        return false;
    }
}
 
开发者ID:YanXs,项目名称:nighthawk,代码行数:16,代码来源:JaRedisFactory.java

示例2: initPool

import redis.clients.jedis.HostAndPort; //导入方法依赖的package包/类
private void initPool(HostAndPort master) {
    if (!master.equals(currentHostMaster)) {
        currentHostMaster = master;
        if (factory == null) {
            factory = new JaRedisFactory(master.getHost(), master.getPort(), connectionTimeout,
                    soTimeout, password, database, clientName);
            initPool(poolConfig, factory);
        } else {
            factory.setHostAndPort(currentHostMaster);
            internalPool.clear();
        }
        log.info("Created JedisPool to master at " + master);
    }
}
 
开发者ID:YanXs,项目名称:nighthawk,代码行数:15,代码来源:JaRedisSentinelPool.java

示例3: ensureMonitored

import redis.clients.jedis.HostAndPort; //导入方法依赖的package包/类
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();
  }
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:11,代码来源:JedisSentinelTest.java

示例4: getHostAndPortFromNodeLine

import redis.clients.jedis.HostAndPort; //导入方法依赖的package包/类
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]));
}
 
开发者ID:x7-framework,项目名称:x7,代码行数:8,代码来源:ClusterNodeInformationParser.java

示例5: RedisClusterTerminal

import redis.clients.jedis.HostAndPort; //导入方法依赖的package包/类
public RedisClusterTerminal(HostAndPort hp) {
    super(hp.getHost(), hp.getPort());
}
 
开发者ID:yanfanvip,项目名称:RedisClusterManager,代码行数:4,代码来源:RedisClusterTerminal.java


注:本文中的redis.clients.jedis.HostAndPort.getPort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。