當前位置: 首頁>>代碼示例>>Java>>正文


Java HostAndPort.equals方法代碼示例

本文整理匯總了Java中redis.clients.jedis.HostAndPort.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java HostAndPort.equals方法的具體用法?Java HostAndPort.equals怎麽用?Java HostAndPort.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在redis.clients.jedis.HostAndPort的用法示例。


在下文中一共展示了HostAndPort.equals方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getResource

import redis.clients.jedis.HostAndPort; //導入方法依賴的package包/類
@Override
public Jedis getResource() {
    while (true) {
        Jedis jedis = super.getResource();
        jedis.setDataSource(this);

        // get a reference because it can change concurrently
        final HostAndPort master = currentHostMaster;
        final HostAndPort connection = new HostAndPort(jedis.getClient().getHost(), jedis.getClient()
                .getPort());

        if (master.equals(connection)) {
            // connected to the correct master
            return jedis;
        } else {
            returnBrokenResource(jedis);
        }
    }
}
 
開發者ID:YanXs,項目名稱:nighthawk,代碼行數:20,代碼來源:JaRedisSentinelPool.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: waitForJedisSentinelPoolRecognizeNewMaster

import redis.clients.jedis.HostAndPort; //導入方法依賴的package包/類
private void waitForJedisSentinelPoolRecognizeNewMaster(JedisSentinelPool pool,
    HostAndPort newMaster) throws InterruptedException {

  while (true) {
    HostAndPort currentHostMaster = pool.getCurrentHostMaster();

    if (newMaster.equals(currentHostMaster)) break;

    System.out.println("JedisSentinelPool's master is not yet changed, sleep...");

    Thread.sleep(100);
  }
}
 
開發者ID:qq1588518,項目名稱:JRediClients,代碼行數:14,代碼來源:JedisSentinelPoolTest.java


注:本文中的redis.clients.jedis.HostAndPort.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。