redis.clients.jedis.Jedis.disconnect()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(6877)

本文整理了Java中redis.clients.jedis.Jedis.disconnect()方法的一些代码示例,展示了Jedis.disconnect()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.disconnect()方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:disconnect

Jedis.disconnect介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-dubbo

public void shutdown() {
  try {
    running = false;
    jedis.disconnect();
  } catch (Throwable t) {
    logger.warn(t.getMessage(), t);
  }
}

代码示例来源:origin: apache/incubator-dubbo

public void shutdown() {
  try {
    running = false;
    jedis.disconnect();
  } catch (Throwable t) {
    logger.warn(t.getMessage(), t);
  }
}

代码示例来源:origin: sohutv/cachecloud

public void shutdown() {
  try {
   log.fine("Shutting down listener on " + host + ":" + port);
   running.set(false);
   // This isn't good, the Jedis object is not thread safe
   if (j != null) {
    j.disconnect();
   }
  } catch (Exception e) {
   log.log(Level.SEVERE, "Caught exception while shutting down: ", e);
  }
 }
}

代码示例来源:origin: ltsopensource/light-task-scheduler

public void shutdown() {
    try {
      running = false;
      jedis.disconnect();
    } catch (Throwable t) {
      LOGGER.warn(t.getMessage(), t);
    }
  }
}

代码示例来源:origin: ltsopensource/light-task-scheduler

public void shutdown() {
    try {
      running = false;
      jedis.disconnect();
    } catch (Throwable t) {
      LOGGER.warn(t.getMessage(), t);
    }
  }
}

代码示例来源:origin: sohutv/cachecloud

public void disconnect() {
 for (Jedis jedis : getAllShards()) {
  try {
   jedis.quit();
  } catch (JedisConnectionException e) {
   // ignore the exception node, so that all other normal nodes can release all connections.
  }
  try {
   jedis.disconnect();
  } catch (JedisConnectionException e) {
   // ignore the exception node, so that all other normal nodes can release all connections.
  }
 }
}

代码示例来源:origin: Dreampie/Resty

private void returnResource(ShardedJedis shardedJedis, Jedis jedis) {
 if (pool != null) {
  if (shardedJedis != null) {
   pool.returnResource(shardedJedis);
  }
  if (jedis != null) {
   pool.returnResource(jedis);
  }
 } else {
  if (jedis != null) {
   jedis.disconnect();
  }
 }
}

代码示例来源:origin: sohutv/cachecloud

@Override
public void destroyObject(PooledObject<ShardedJedis> pooledShardedJedis) throws Exception {
 final ShardedJedis shardedJedis = pooledShardedJedis.getObject();
 for (Jedis jedis : shardedJedis.getAllShards()) {
  try {
   try {
    jedis.quit();
   } catch (Exception e) {
   }
   jedis.disconnect();
  } catch (Exception e) {
  }
 }
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
protected boolean isActive(RedisNode node) {
  Jedis temp = null;
  try {
    temp = getJedis(node);
    temp.connect();
    return temp.ping().equalsIgnoreCase("pong");
  } catch (Exception e) {
    return false;
  } finally {
    if (temp != null) {
      temp.disconnect();
      temp.close();
    }
  }
}

代码示例来源:origin: zendesk/maxwell

if (e instanceof JedisConnectionException) {
  logger.warn("lost connection to server, trying to reconnect...", e);
  jedis.disconnect();
  jedis.connect();
} else {

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public void close() throws DataAccessException {
  super.close();
  // return the connection to the pool
  if (pool != null) {
    jedis.close();
    return;
  }
  // else close the connection normally (doing the try/catch dance)
  Exception exc = null;
  try {
    jedis.quit();
  } catch (Exception ex) {
    exc = ex;
  }
  try {
    jedis.disconnect();
  } catch (Exception ex) {
    exc = ex;
  }
  if (exc != null)
    throw convertJedisAccessException(exc);
}

代码示例来源:origin: Impetus/Kundera

@Override
public void close()
{
  if (settings != null)
  {
    settings.clear();
    settings = null;
  }
  if (connection != null)
  {
    connection.disconnect();
    connection = null;
  }
  reader = null;
}

代码示例来源:origin: uber/chaperone

REDIS_CAS_FAILURE.mark();
 jedis.disconnect();
 Thread.sleep(500);
} finally {

代码示例来源:origin: uber/chaperone

@Override
 public void run() {
  try {
   String memoryStats = jedis.info("Memory");
   loadMetrics(memoryStats);
   String keyStats = jedis.info("Keyspace");
   loadMetrics(keyStats);
   String stats = jedis.info("Stats");
   loadMetrics(stats);
  } catch (Exception e) {
   logger.warn("RedisMonitor got exception to get info from Redis server. Reconnect next time.", e);
   // disconnect so that next time the jedis can reconnect
   jedis.disconnect();
  } catch (Throwable t) {
   logger.error("RedisMonitor got error to get info from Redis server", t);
   throw t;
  }
 }
}, checkIntervalInSec, checkIntervalInSec, TimeUnit.SECONDS);

代码示例来源:origin: Impetus/Kundera

@Override
public void destroy()
{
  // if(logger.isDebugEnabled())
  logger.info("on close destroying connection pool");
  if (getConnectionPoolOrConnection() != null && getConnectionPoolOrConnection() instanceof JedisPool)
  {
    ((JedisPool) getConnectionPoolOrConnection()).destroy();
  }
  else if (getConnectionPoolOrConnection() != null && getConnectionPoolOrConnection() instanceof Jedis)
  {
    ((Jedis) getConnectionPoolOrConnection()).disconnect();
  }
}

代码示例来源:origin: knightliao/disconf-demos-java

/**
 * 关闭
 */
public void destroy() throws Exception {
  if (jedis != null) {
    jedis.disconnect();
  }
}

代码示例来源:origin: knightliao/disconf-demos-java

/**
 * 关闭
 */
public void destroy() throws Exception {
  if (jedis != null) {
    jedis.disconnect();
  }
}

代码示例来源:origin: org.arquillian.ape/arquillian-ape-nosql-redis

@Override
public void disconnect() {
  if (jedis != null) {
    jedis.disconnect();
  }
}

代码示例来源:origin: com.alibaba/dubbo

public void shutdown() {
  try {
    running = false;
    jedis.disconnect();
  } catch (Throwable t) {
    logger.warn(t.getMessage(), t);
  }
}

代码示例来源:origin: com.netflix.dyno/dyno-jedis

@Override
public void close() {
  jedisClient.quit();
  jedisClient.disconnect();
}

相关文章

微信公众号

最新文章

更多

Jedis类方法