Example usage for org.springframework.data.redis.connection PoolException PoolException

List of usage examples for org.springframework.data.redis.connection PoolException PoolException

Introduction

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

Prototype

public PoolException(@Nullable String msg, @Nullable Throwable cause) 

Source Link

Document

Constructs a new PoolException instance.

Usage

From source file:org.springframework.data.redis.connection.jredis.JredisPool.java

public JRedis getResource() {
    try {/*from w  w  w.  j  a  v  a  2 s .co  m*/
        return internalPool.borrowObject();
    } catch (Exception e) {
        throw new PoolException("Could not get a resource from the pool", e);
    }
}

From source file:org.springframework.data.redis.connection.jredis.JredisPool.java

public void returnBrokenResource(final JRedis resource) {
    try {/*from www . j a va2s  . com*/
        internalPool.invalidateObject(resource);
    } catch (Exception e) {
        throw new PoolException("Could not invalidate the broken resource", e);
    }
}

From source file:org.springframework.data.redis.connection.jredis.JredisPool.java

public void returnResource(final JRedis resource) {
    try {//from   w  w w  . ja  va  2  s  .  com
        internalPool.returnObject(resource);
    } catch (Exception e) {
        throw new PoolException("Could not return the resource to the pool", e);
    }
}

From source file:org.springframework.data.redis.connection.jredis.JredisPool.java

public void destroy() {
    try {/*  w  ww.j a  v a2  s  . c  o m*/
        internalPool.close();
    } catch (Exception e) {
        throw new PoolException("Could not destroy the pool", e);
    }
}

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

@SuppressWarnings("unchecked")
public RedisAsyncConnection<byte[], byte[]> getResource() {
    try {//  www . j a va  2 s .c o  m
        return internalPool.borrowObject();
    } catch (Exception e) {
        throw new PoolException("Could not get a resource from the pool", e);
    }
}

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

public void returnBrokenResource(final RedisAsyncConnection<byte[], byte[]> resource) {
    try {/*from ww  w  .  j  a  v a 2  s  .c om*/
        internalPool.invalidateObject(resource);
    } catch (Exception e) {
        throw new PoolException("Could not invalidate the broken resource", e);
    }
}

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

public void returnResource(final RedisAsyncConnection<byte[], byte[]> resource) {
    try {/*from  ww  w. j  av a2s .c  o m*/
        internalPool.returnObject(resource);
    } catch (Exception e) {
        throw new PoolException("Could not return the resource to the pool", e);
    }
}

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

public void destroy() {
    try {/*from   w w w .  j a va 2s . c om*/
        client.shutdown();
        internalPool.close();
    } catch (Exception e) {
        throw new PoolException("Could not destroy the pool", e);
    }
}

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

@Override
public <T extends StatefulConnection<?, ?>> T getConnection(Class<T> connectionType) {

    GenericObjectPool<StatefulConnection<?, ?>> pool = pools.computeIfAbsent(connectionType, poolType -> {
        return ConnectionPoolSupport.createGenericObjectPool(
                () -> connectionProvider.getConnection(connectionType), poolConfig, false);
    });// ww  w  . j av a 2  s  . co  m

    try {

        StatefulConnection<?, ?> connection = pool.borrowObject();

        poolRef.put(connection, pool);

        return connectionType.cast(connection);
    } catch (Exception e) {
        throw new PoolException("Could not get a resource from the pool", e);
    }
}