本文整理匯總了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);
}
}
}
示例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);
}
}
示例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);
}
}