private RedisNode selectActiveSentinel() { Assert.state(hasRedisSentinelConfigured(), "Sentinel configuration missing!"); for (RedisNode node : this.sentinelConfiguration.getSentinels()) { if (isActive(node)) { return node; } } throw new InvalidDataAccessApiUsageException("Could not find any active sentinels"); }
@Override public RedisSentinelConnection getSentinelConnection() { if (!hasRedisSentinelConfigured()) { throw new InvalidDataAccessResourceUsageException("No sentinels configured."); } RedisNode node = selectActiveSentinel(); RedisSentinelConnection connection = connectionCache.get(node); if (connection == null || !connection.isOpen()) { connection = getSentinelConnection(node); connectionCache.putIfAbsent(node, connection); } return connection; }
private RedisNode selectActiveSentinel() { Assert.state(hasRedisSentinelConfigured(), "Sentinel configuration missing!"); for (RedisNode node : this.sentinelConfiguration.getSentinels()) { if (isActive(node)) { return node; } } throw new InvalidDataAccessApiUsageException("Could not find any active sentinels"); }
private RedisNode selectActiveSentinel() { Assert.state(hasRedisSentinelConfigured(), "Sentinel configuration missing!"); for (RedisNode node : this.sentinelConfiguration.getSentinels()) { if (isActive(node)) { return node; } } throw new InvalidDataAccessApiUsageException("Could not find any active sentinels"); }
@Override public RedisSentinelConnection getSentinelConnection() { if (!hasRedisSentinelConfigured()) { throw new InvalidDataAccessResourceUsageException("No sentinels configured."); } RedisNode node = selectActiveSentinel(); RedisSentinelConnection connection = connectionCache.get(node); if (connection == null || !connection.isOpen()) { connection = getSentinelConnection(node); connectionCache.putIfAbsent(node, connection); } return connection; }
@Override public RedisSentinelConnection getSentinelConnection() { if (!hasRedisSentinelConfigured()) { throw new InvalidDataAccessResourceUsageException("No sentinels configured."); } RedisNode node = selectActiveSentinel(); RedisSentinelConnection connection = connectionCache.get(node); if (connection == null || !connection.isOpen()) { connection = getSentinelConnection(node); connectionCache.putIfAbsent(node, connection); } return connection; }