springboot-note
springboot-note copied to clipboard
Spring Boot+Vue 书籍学习 demo
Bumps [guava](https://github.com/google/guava) from 29.0-jre to 32.0.0-jre. Release notes Sourced from guava's releases. 32.0.0 Maven <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>32.0.0-jre</version> <!-- or, for Android: --> <version>32.0.0-android</version> </dependency> Jar files 32.0.0-jre.jar 32.0.0-android.jar Guava...
Bumps [json-smart](https://github.com/netplex/json-smart-v2) from 2.4.1 to 2.4.9. Release notes Sourced from json-smart's releases. V 2.4.9 V 2.4.9 (2023-03-07) Add depth limit of 400 when parsing JSON. What's Changed allow config init...
boolean isSuccess = redisTemplate.opsForValue().setIfAbsent(businessKey, uniqueValue); if (!isSuccess) { throw new Exception("You can't do it,because another has get the lock =-="); } redisTemplate.expire(businessKey, annotation.lockTime(), TimeUnit.SECONDS); 这块redis操作,不是原子的,如果在设置过期时间前,突然宕机了,则加锁后的key将长时间存在, 应该用 Boolean setIfAbsent(K key, V...
finally { // 请求结束后,强制删掉 key,释放锁 redisTemplate.delete(businessKey); log.info("release the lock, businessKey is [" + businessKey + "]"); } 如果A线程锁操作超时了,但是还在执行,此时B线程进入了拿到锁并进行操作,此时A线程去释放锁,释放的就是B此时持有的锁。 此处应该加入判断,来释放锁的线程是否是持有锁的那个线程。 可以改成 finally { try { RedisLockDefinitionHolder redisLockDefinitionHolder = holderList.stream().filter(h -> businessKey.equals(h.getBusinessKey())).findFirst().orElse(null);...