# dsync **Repository Path**: laxiangxiang/dsync ## Basic Information - **Project Name**: dsync - **Description**: 分布式锁,基于Netty长连接实现,自定义协议,高性能锁 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: https://github.com/cyejing/dsync - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 24 - **Created**: 2021-04-07 - **Last Updated**: 2021-11-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Distributed Synchronize 分布式同步组件 1. 分布式锁. 2. 基于Netty长连接实现. 3. 自定义协议,内置等待队列,性能远超redis锁. 4. 服务下线立刻感知,无需等待超时. 5. 支持优雅关闭. 6. 规避Redis分布式锁缺陷: http://zhangtielei.com/posts/blog-redlock-reasoning.html , http://zhangtielei.com/posts/blog-redlock-reasoning-part2.html ### 启动服务端 ``` java -jar -server dsync-dominate-xxx.jar ``` 启动jar可以在maven下载,或者下载源码 ``mvn package`` 获得. ### 分布式锁 DLock 1. 添加依赖 ```xml cn.cyejing dsync-toolkit ``` 2. 使用方法 ```java Config config = Config.config().host("localhost").port(4843); //配置服务端地址 DSync dSync = DSync.create(config); DLock lock = dSync.getLock(); try { lock.lock("adder"); //Do Something } finally { lock.unlock(); } ```