摘要:
1、Zookeeper的数据结构 二、zookeeper分布式锁原理 二、zookeeper分布式锁代码实现 1、maven依赖 (1)https://mvnrepository.com/ 搜索 zookeeper (2)选择安装的对应版本 (3) pom 文件 添加依赖 <dependency> 阅读全文
2021年3月26日 #
摘要:
一、基于分布式锁解决定时任务重复问题 1、定时任务部署集群 二、利用redis分布式锁解决定时任务重复发送短信 1、启用定时任务 package com.example.distributelock; import org.mybatis.spring.annotation.MapperScan; 阅读全文
摘要:
一、 redis分布式锁原理 并发 到Redis里变成了串行排队,单线程 二、基于Redis的Setnx实现分布式锁 1、pom <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-star 阅读全文
摘要:
一、基于数据库悲观锁的分布式锁 代码 package com.example.distributelock.controller; import com.example.distributelock.dao.DistributeLockMapper; import com.example.distr 阅读全文
摘要:
一、如何使用锁解决电商中的超卖的问题? 1、模拟5个线程并发执行。使用CyclicBarrier类 package com.example.distributedemo; import com.example.distributedemo.service.OrderService; import o 阅读全文