Example usage for org.springframework.data.redis.connection.lettuce LettuceConnectionFactory getShutdownTimeout

List of usage examples for org.springframework.data.redis.connection.lettuce LettuceConnectionFactory getShutdownTimeout

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection.lettuce LettuceConnectionFactory getShutdownTimeout.

Prototype

public long getShutdownTimeout() 

Source Link

Document

Returns the shutdown timeout for shutting down the RedisClient (in milliseconds).

Usage

From source file:org.springframework.boot.autoconfigure.data.redis.RedisAutoConfigurationTests.java

@Test
public void testOverrideRedisConfiguration() {
    this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.database:1",
            "spring.redis.lettuce.shutdown-timeout:500").run((context) -> {
                LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
                assertThat(cf.getHostName()).isEqualTo("foo");
                assertThat(cf.getDatabase()).isEqualTo(1);
                assertThat(cf.getPassword()).isNull();
                assertThat(cf.isUseSsl()).isFalse();
                assertThat(cf.getShutdownTimeout()).isEqualTo(500);
            });//from w w w.j  a v  a 2 s  .c  om
}

From source file:org.springframework.boot.autoconfigure.data.redis.RedisAutoConfigurationTests.java

@Test
public void testRedisConfigurationWithPool() {
    this.contextRunner
            .withPropertyValues("spring.redis.host:foo", "spring.redis.lettuce.pool.min-idle:1",
                    "spring.redis.lettuce.pool.max-idle:4", "spring.redis.lettuce.pool.max-active:16",
                    "spring.redis.lettuce.pool.max-wait:2000", "spring.redis.lettuce.shutdown-timeout:1000")
            .run((context) -> {/*from w w  w  .j ava2s  .  c o  m*/
                LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
                assertThat(cf.getHostName()).isEqualTo("foo");
                GenericObjectPoolConfig<?> poolConfig = getPoolingClientConfiguration(cf).getPoolConfig();
                assertThat(poolConfig.getMinIdle()).isEqualTo(1);
                assertThat(poolConfig.getMaxIdle()).isEqualTo(4);
                assertThat(poolConfig.getMaxTotal()).isEqualTo(16);
                assertThat(poolConfig.getMaxWaitMillis()).isEqualTo(2000);
                assertThat(cf.getShutdownTimeout()).isEqualTo(1000);
            });
}