package com.example.demo.util;
import org.redisson.Redisson;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.TimeUnit;
public class RedisLock {
public static RedissonClient redissonClient = getRedissonClient();
public static void main(String... args) {
//模拟并发场景
Thread one = new Thread() {
@Override
public void run() {
// RedisLock.lock(redissonClient);
// RedisLock.trylock(redissonClient);
// RedisLock.lockNoWtachDog(redissonClient);
RedisLock.trylockNoWatchDog(redissonClient);
}
};
one.start();
// Thread two = new Thread() {
// @Override
// public void run() {
// RedisLockOne.lock(redissonCli
|