Java 类org.springframework.boot.autoconfigure.data.redis.RedisProperties.Sentinel 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RedisAutoConfiguration.java   
private List<RedisNode> createSentinels(Sentinel sentinel) {
    List<RedisNode> nodes = new ArrayList<RedisNode>();
    for (String node : StringUtils
            .commaDelimitedListToStringArray(sentinel.getNodes())) {
        try {
            String[] parts = StringUtils.split(node, ":");
            Assert.state(parts.length == 2, "Must be defined as 'host:port'");
            nodes.add(new RedisNode(parts[0], Integer.valueOf(parts[1])));
        }
        catch (RuntimeException ex) {
            throw new IllegalStateException(
                    "Invalid redis sentinel " + "property '" + node + "'", ex);
        }
    }
    return nodes;
}
项目:spring-boot-concourse    文件:RedisAutoConfiguration.java   
private List<RedisNode> createSentinels(Sentinel sentinel) {
    List<RedisNode> nodes = new ArrayList<RedisNode>();
    for (String node : StringUtils
            .commaDelimitedListToStringArray(sentinel.getNodes())) {
        try {
            String[] parts = StringUtils.split(node, ":");
            Assert.state(parts.length == 2, "Must be defined as 'host:port'");
            nodes.add(new RedisNode(parts[0], Integer.valueOf(parts[1])));
        }
        catch (RuntimeException ex) {
            throw new IllegalStateException(
                    "Invalid redis sentinel " + "property '" + node + "'", ex);
        }
    }
    return nodes;
}
项目:contestparser    文件:RedisAutoConfiguration.java   
private List<RedisNode> createSentinels(Sentinel sentinel) {
    List<RedisNode> sentinels = new ArrayList<RedisNode>();
    String nodes = sentinel.getNodes();
    for (String node : StringUtils.commaDelimitedListToStringArray(nodes)) {
        try {
            String[] parts = StringUtils.split(node, ":");
            Assert.state(parts.length == 2, "Must be defined as 'host:port'");
            sentinels.add(new RedisNode(parts[0], Integer.valueOf(parts[1])));
        }
        catch (RuntimeException ex) {
            throw new IllegalStateException(
                    "Invalid redis sentinel " + "property '" + node + "'", ex);
        }
    }
    return sentinels;
}
项目:cereebro    文件:RedisRelationshipDetectorTest.java   
@Test
public void shouldUseSentinelMasterName() {
    String name = "name";
    RedisConnectionFactory factory = Mockito.mock(RedisConnectionFactory.class);
    RedisProperties props = new RedisProperties();
    props.setSentinel(new Sentinel());
    props.getSentinel().setMaster(name);
    RedisRelationshipDetector detector = new RedisRelationshipDetector(props, Arrays.asList(factory));
    Set<Relationship> rels = new HashSet<>();
    rels.add(Dependency.on(Component.of(name, ComponentType.REDIS)));
    Assertions.assertThat(detector.detect()).isEqualTo(rels);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RedisAutoConfiguration.java   
protected final RedisSentinelConfiguration getSentinelConfig() {
    if (this.sentinelConfiguration != null) {
        return this.sentinelConfiguration;
    }
    Sentinel sentinelProperties = this.properties.getSentinel();
    if (sentinelProperties != null) {
        RedisSentinelConfiguration config = new RedisSentinelConfiguration();
        config.master(sentinelProperties.getMaster());
        config.setSentinels(createSentinels(sentinelProperties));
        return config;
    }
    return null;
}
项目:spring-boot-concourse    文件:RedisAutoConfiguration.java   
protected final RedisSentinelConfiguration getSentinelConfig() {
    if (this.sentinelConfiguration != null) {
        return this.sentinelConfiguration;
    }
    Sentinel sentinelProperties = this.properties.getSentinel();
    if (sentinelProperties != null) {
        RedisSentinelConfiguration config = new RedisSentinelConfiguration();
        config.master(sentinelProperties.getMaster());
        config.setSentinels(createSentinels(sentinelProperties));
        return config;
    }
    return null;
}
项目:contestparser    文件:RedisAutoConfiguration.java   
protected final RedisSentinelConfiguration getSentinelConfig() {
    if (this.sentinelConfiguration != null) {
        return this.sentinelConfiguration;
    }
    Sentinel sentinelProperties = this.properties.getSentinel();
    if (sentinelProperties != null) {
        RedisSentinelConfiguration config = new RedisSentinelConfiguration();
        config.master(sentinelProperties.getMaster());
        config.setSentinels(createSentinels(sentinelProperties));
        return config;
    }
    return null;
}