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

x33g5p2x  于2022-01-30 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(168)

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

Transaction.close介绍

暂无

代码示例

代码示例来源:origin: davidmarquis/redis-scheduler

@Override
public boolean exec() {
  try {
    return Optional.ofNullable(txn)
            .map(Transaction::exec)
            .map(col -> !col.isEmpty())
            .orElse(false);
  } finally {
    try {
      txn.close();
    } catch (IOException e) {
      throw new RedisConnectException(e);
    }
    txn = null;
  }
}

代码示例来源:origin: Sunybyjava/wenda

/**
 * 执行事物块里面的命令
 * @param tx
 * @param jedis
 * @return
 */
public List<Object> exec(Transaction tx, Jedis jedis) {
  try {
    return tx.exec();
  } catch (Exception e) {
    logger.error("发生异常", e.getMessage());
    tx.discard();
  } finally {
    if (tx != null) {
      try {
        tx.close();
      } catch (IOException e) {
        logger.error("关闭redis事物发生异常" + e.getMessage());
      }
    }
    if (jedis != null) {
      jedis.close();
    }
  }
  return null;
}

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

public void resetState() {
 if (client.isConnected()) {
  if (transaction != null) {
   transaction.close();
  }
  if (pipeline != null) {
   pipeline.close();
  }
  client.resetState();
 }
 transaction = null;
 pipeline = null;
}

相关文章

微信公众号

最新文章

更多

Transaction类方法