这个是在网上找到的一个大神写的(http://wudashan.cn/2017/10/23/Redis-Distributed-Lock-Implement/),对于分布式redis部署的,可以参考redisson(https://github.com/redisson/redisson/tree/master/redisson/src/main/java/org/redisson)
关于redis分布式锁的实现方式(转载)
原文:http://www.cnblogs.com/cqjy520/p/7954923.html