public void shutdown() { if (_log.isDebugEnabled()) _log.debug(format("Closing %d Jedis instance(s)", _queue.size())); BinaryJedis instance; while ((instance = _queue.poll()) != null) { try { instance.close(); } catch (Exception e) { /* ignore exception */ } } }
_log.debug(format("Removing connection #%d since it cannot be pinged", _queue.size())); try { res.close(); } catch (Exception e2) { /* ignore */ }
@AfterMethod public void tearDown() throws Exception { if (redisClient != null) { redisClient.close(); redisClient = null; } if (embeddedRedisServer != null) { embeddedRedisServer.stop(); embeddedRedisServer = null; } _tomcat1.stop(); }
@Override public T call() throws Exception { BinaryJedis jedis = null; // Borrow an instance from Jedis without checking it for performance reasons and execute the command on it try { jedis = _pool.borrowInstance(false); return execute(jedis); } catch (JedisConnectionException e) { // Connection error occurred with this Jedis connection, so now make sure to get a known-good one // The old connection is not given back to the pool since it is defunct anyway if (_log.isDebugEnabled()) _log.debug("Connection error occurred, discarding Jedis connection: " + e.getMessage()); if (jedis != null) try { jedis.close(); } catch (Exception e2) { /* ignore */ } jedis = null; } finally { if (jedis != null) _pool.returnInstance(jedis); } // Try to execute the command again with a known-good instance try { jedis = _pool.borrowInstance(true); return execute(jedis); } finally { if (jedis != null) _pool.returnInstance(jedis); } }
public void shutdown() { if (_log.isDebugEnabled()) _log.debug(format("Closing %d Jedis instance(s)", _queue.size())); BinaryJedis instance; while ((instance = _queue.poll()) != null) { try { instance.close(); } catch (Exception e) { /* ignore exception */ } } }
@Override public void close() { if (dataSource != null) { JedisPoolAbstract pool = this.dataSource; this.dataSource = null; if (client.isBroken()) { pool.returnBrokenResource(this); } else { pool.returnResource(this); } } else { super.close(); } }
_log.debug(format("Removing connection #%d since it cannot be pinged", _queue.size())); try { res.close(); } catch (Exception e2) { /* ignore */ }
@Override public T call() throws Exception { BinaryJedis jedis = null; // Borrow an instance from Jedis without checking it for performance reasons and execute the command on it try { jedis = _pool.borrowInstance(false); return execute(jedis); } catch (JedisConnectionException e) { // Connection error occurred with this Jedis connection, so now make sure to get a known-good one // The old connection is not given back to the pool since it is defunct anyway if (_log.isDebugEnabled()) _log.debug("Connection error occurred, discarding Jedis connection: " + e.getMessage()); if (jedis != null) try { jedis.close(); } catch (Exception e2) { /* ignore */ } jedis = null; } finally { if (jedis != null) _pool.returnInstance(jedis); } // Try to execute the command again with a known-good instance try { jedis = _pool.borrowInstance(true); return execute(jedis); } finally { if (jedis != null) _pool.returnInstance(jedis); } }