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

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

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

Jedis.quit介绍

暂无

代码示例

代码示例来源: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: 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
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: arcturus/android-live-storm

public void end() {
    if(jedis != null) {
      jedis.quit();
    }
  }
}

代码示例来源:origin: io.leopard/leopard-redis

@Override
public String quit() {
  return jedis.quit();
}

代码示例来源:origin: penggle/jedis-ms-sentinel

public String quit() {
  return master.quit();
}

代码示例来源:origin: gresrun/jesque

/**
 * {@inheritDoc}
 */
@Override
public void end() {
  if (this.keepAliveService != null) {
    this.keepAliveService.shutdownNow();
  }
  this.jedis.quit();
}

代码示例来源:origin: gresrun/jesque

/**
 * {@inheritDoc}
 */
@Override
public void end() {
  ensureJedisConnection();
  if (this.keepAliveService != null) {
    this.keepAliveService.shutdownNow();
  }
  this.jedis.quit();
}

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

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

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

@Override
public String quit() {
 String command = "quit";
 return instrumented(command, () -> delegated.quit());
}

代码示例来源:origin: io.enoa/nosql-redis

default String quit() {
 return this.run((jedis, serializer) -> jedis.quit());
}

代码示例来源:origin: org.nutz/nutz-integration-jedis

/**
 * Ask the server to silently close the connection.
 */
public String quit() {
  Jedis jedis = getJedis();
  try {
    return jedis.quit();
  } finally {Streams.safeClose(jedis);}
}

代码示例来源:origin: gresrun/jesque

/**
 * {@inheritDoc}
 */
@Override
public void run() {
  if (this.state.compareAndSet(NEW, RUNNING)) {
    try {
      LOG.debug("AdminImpl starting up");
      this.threadRef.set(Thread.currentThread());
      while (!isShutdown()) {
        this.jedis.subscribe(this.jedisPubSub, createFullChannels());
      }
    } finally {
      LOG.debug("AdminImpl shutting down");
      this.jedis.quit();
      this.threadRef.set(null);
    }
  } else {
    if (RUNNING.equals(this.state.get())) {
      throw new IllegalStateException("This AdminImpl is already running");
    } else {
      throw new IllegalStateException("This AdminImpl is shutdown");
    }
  }
}

代码示例来源:origin: tangyanbo/springmore

/**
 * 在Pool以外强行销毁Jedis.
 */
public static void destroyJedis(Jedis jedis) {
  if ((jedis != null) && jedis.isConnected()) {
    try {
      try {
        jedis.quit();
      } catch (Exception e) {
      }
      jedis.disconnect();
    } catch (Exception e) {
    }
  }
}

代码示例来源:origin: warmbreeze/sharded-jedis-sentinel-pool

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: DarkPhoenixs/connection-pool-client

@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: gresrun/jesque

/**
 * Ensure that the given connection is established.
 * 
 * @param jedis
 *            a connection to Redis
 * @return true if the supplied connection was already connected
 */
public static boolean ensureJedisConnection(final Jedis jedis) {
  final boolean jedisOK = testJedisConnection(jedis);
  if (!jedisOK) {
    try {
      jedis.quit();
    } catch (Exception e) {
    } // Ignore
    try {
      jedis.disconnect();
    } catch (Exception e) {
    } // Ignore
    jedis.connect();
  }
  return jedisOK;
}

代码示例来源:origin: apache/servicemix-bundles

public void disconnect() {
 for (Jedis jedis : getAllShards()) {
  if (jedis.isConnected()) {
   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: apache/servicemix-bundles

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

代码示例来源:origin: tonivade/claudb

@Test
public void testCommands() {
 execute(jedis -> {
  assertThat(jedis.ping(), equalTo("PONG"));
  assertThat(jedis.echo("Hi!"), equalTo("Hi!"));
  assertThat(jedis.set("a", "1"), equalTo("OK"));
  assertThat(jedis.strlen("a"), equalTo(1L));
  assertThat(jedis.strlen("b"), equalTo(0L));
  assertThat(jedis.exists("a"), equalTo(true));
  assertThat(jedis.exists("b"), equalTo(false));
  assertThat(jedis.get("a"), equalTo("1"));
  assertThat(jedis.get("b"), nullValue());
  assertThat(jedis.getSet("a", "2"), equalTo("1"));
  assertThat(jedis.get("a"), equalTo("2"));
  assertThat(jedis.del("a"), equalTo(1L));
  assertThat(jedis.get("a"), nullValue());
  assertThat(jedis.eval("return 1"), equalTo(1L));
  assertThat(jedis.quit(), equalTo("OK"));
 });
}

相关文章

微信公众号

最新文章

更多

Jedis类方法