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

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

Introduction

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

Prototype

@Deprecated
public void setShutdownTimeout(long shutdownTimeout) 

Source Link

Document

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

Usage

From source file:io.pivotal.cla.config.SessionConfig.java

@Bean
@ConditionalOnMissingBean(RedisConnectionFactory.class)
public RedisConnectionFactory redisConnectionFactory(RedisProperties redisProperties) {

    LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory();
    connectionFactory.setPort(redisProperties.getPort());
    connectionFactory.setHostName(redisProperties.getHost());
    connectionFactory.setPassword(redisProperties.getPassword());
    connectionFactory.setShutdownTimeout(0);

    return connectionFactory;
}

From source file:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactoryTests.java

@Test
public void testSelectDb() {

    LettuceConnectionFactory factory2 = new LettuceConnectionFactory(SettingsUtils.getHost(),
            SettingsUtils.getPort());/*from w ww.jav  a  2s  .c  o m*/
    factory2.setClientResources(LettuceTestClientResources.getSharedClientResources());
    factory2.setShutdownTimeout(0);
    factory2.setDatabase(1);
    factory2.afterPropertiesSet();

    ConnectionFactoryTracker.add(factory2);

    StringRedisConnection connection2 = new DefaultStringRedisConnection(factory2.getConnection());
    connection2.flushDb();
    // put an item in database 0
    connection.set("sometestkey", "sometestvalue");
    try {
        // there should still be nothing in database 1
        assertEquals(Long.valueOf(0), connection2.dbSize());
    } finally {
        connection2.close();
        factory2.destroy();
    }
}

From source file:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactoryTests.java

@Test
public void testCreateFactoryWithPool() {
    DefaultLettucePool pool = new DefaultLettucePool(SettingsUtils.getHost(), SettingsUtils.getPort());
    pool.setClientResources(LettuceTestClientResources.getSharedClientResources());
    pool.afterPropertiesSet();/*from www  .ja  va  2  s. c o  m*/
    LettuceConnectionFactory factory2 = new LettuceConnectionFactory(pool);
    factory2.setShutdownTimeout(0);
    factory2.afterPropertiesSet();

    ConnectionFactoryTracker.add(factory2);

    RedisConnection conn2 = factory2.getConnection();
    conn2.close();
    factory2.destroy();
    pool.destroy();
}

From source file:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactoryTests.java

@Test // DATAREDIS-462
public void factoryWorksWithoutClientResources() {

    LettuceConnectionFactory factory = new LettuceConnectionFactory();
    factory.setShutdownTimeout(0);
    factory.afterPropertiesSet();/*from   w  ww.j  a v a  2s  .  c o m*/

    ConnectionFactoryTracker.add(factory);

    StringRedisConnection connection = new DefaultStringRedisConnection(factory.getConnection());

    try {
        assertThat(connection.ping(), is(equalTo("PONG")));
    } finally {
        connection.close();
    }
}