@Override public void destroy() throws Exception { if (connection != null) { connectionProvider.release(connection); } } }
/** * Reset the underlying shared Connection, to be reinitialized on next access. */ void resetConnection() { synchronized (this.connectionMonitor) { if (this.connection != null) { this.connectionProvider.release(this.connection); } this.connection = null; } } }
@Override public void close() throws IOException { provider.release(connection); }
@Override protected boolean isActive(RedisNode node) { StatefulRedisSentinelConnection<String, String> connection = null; try { connection = getConnection(node); return connection.sync().ping().equalsIgnoreCase("pong"); } catch (Exception e) { return false; } finally { if (connection != null) { connectionProvider.release(connection); } } }
protected void doClose() { if (!getChannels().isEmpty()) { pubsub.unsubscribe(new byte[0]); } if (!getPatterns().isEmpty()) { pubsub.punsubscribe(new byte[0]); } connection.removeListener(this.listener); connectionProvider.release(connection); }
@Override public void close() throws DataAccessException { super.close(); if (isClosed) { return; } isClosed = true; if (asyncDedicatedConn != null) { try { connectionProvider.release(asyncDedicatedConn); } catch (RuntimeException ex) { throw convertLettuceAccessException(ex); } } if (subscription != null) { if (subscription.isAlive()) { subscription.doClose(); } subscription = null; } this.dbIndex = defaultDbIndex; }
/** * Validate the connection. Invalid connections will be closed and the connection state will be reset. */ void validateConnection() { synchronized (this.connectionMonitor) { boolean valid = false; if (connection != null && connection.isOpen()) { try { if (connection instanceof StatefulRedisConnection) { ((StatefulRedisConnection) connection).sync().ping(); } if (connection instanceof StatefulRedisClusterConnection) { ((StatefulRedisConnection) connection).sync().ping(); } valid = true; } catch (Exception e) { log.debug("Validation failed", e); } } if (!valid) { if (connection != null) { connectionProvider.release(connection); } log.warn("Validation of shared connection failed. Creating a new connection."); resetConnection(); this.connection = getNativeConnection(); } } }
/** * Reset the underlying shared Connection, to be reinitialized on next access. */ void resetConnection() { synchronized (this.connectionMonitor) { if (this.connection != null) { this.connectionProvider.release(this.connection); } this.connection = null; } } }
@Override public void destroy() throws Exception { if (connection != null) { connectionProvider.release(connection); } } }
/** * Reset the underlying shared Connection, to be reinitialized on next access. */ void resetConnection() { synchronized (this.connectionMonitor) { if (this.connection != null) { this.connectionProvider.release(this.connection); } this.connection = null; } } }
@Override public void destroy() throws Exception { if (connection != null) { connectionProvider.release(connection); } } }
@Override public void close() throws IOException { provider.release(connection); }
@Override public void close() throws IOException { provider.release(connection); }
@Override protected boolean isActive(RedisNode node) { StatefulRedisSentinelConnection<String, String> connection = null; try { connection = getConnection(node); return connection.sync().ping().equalsIgnoreCase("pong"); } catch (Exception e) { return false; } finally { if (connection != null) { connectionProvider.release(connection); } } }
@Override protected boolean isActive(RedisNode node) { StatefulRedisSentinelConnection<String, String> connection = null; try { connection = getConnection(node); return connection.sync().ping().equalsIgnoreCase("pong"); } catch (Exception e) { return false; } finally { if (connection != null) { connectionProvider.release(connection); } } }
protected void doClose() { if (!getChannels().isEmpty()) { pubsub.unsubscribe(new byte[0]); } if (!getPatterns().isEmpty()) { pubsub.punsubscribe(new byte[0]); } connection.removeListener(this.listener); connectionProvider.release(connection); }
protected void doClose() { if (!getChannels().isEmpty()) { pubsub.unsubscribe(new byte[0]); } if (!getPatterns().isEmpty()) { pubsub.punsubscribe(new byte[0]); } connection.removeListener(this.listener); connectionProvider.release(connection); }
@Override public void close() throws DataAccessException { super.close(); if (isClosed) { return; } isClosed = true; if (asyncDedicatedConn != null) { try { connectionProvider.release(asyncDedicatedConn); } catch (RuntimeException ex) { throw convertLettuceAccessException(ex); } } if (subscription != null) { if (subscription.isAlive()) { subscription.doClose(); } subscription = null; } this.dbIndex = defaultDbIndex; }
@Override public void close() throws DataAccessException { super.close(); if (isClosed) { return; } isClosed = true; if (asyncDedicatedConn != null) { try { connectionProvider.release(asyncDedicatedConn); } catch (RuntimeException ex) { throw convertLettuceAccessException(ex); } } if (subscription != null) { if (subscription.isAlive()) { subscription.doClose(); } subscription = null; } this.dbIndex = defaultDbIndex; }
/** * Validate the connection. Invalid connections will be closed and the connection state will be reset. */ void validateConnection() { synchronized (this.connectionMonitor) { boolean valid = false; if (connection != null && connection.isOpen()) { try { if (connection instanceof StatefulRedisConnection) { ((StatefulRedisConnection) connection).sync().ping(); } if (connection instanceof StatefulRedisClusterConnection) { ((StatefulRedisConnection) connection).sync().ping(); } valid = true; } catch (Exception e) { log.debug("Validation failed", e); } } if (!valid) { if (connection != null) { connectionProvider.release(connection); } log.warn("Validation of shared connection failed. Creating a new connection."); resetConnection(); this.connection = getNativeConnection(); } } }