dsync

分布式锁,基于Netty长连接实现,自定义协议,高性能锁

License

License

GroupId

GroupId

cn.cyejing
ArtifactId

ArtifactId

dsync
Last Version

Last Version

0.1.3
Release Date

Release Date

Type

Type

pom
Description

Description

dsync
分布式锁,基于Netty长连接实现,自定义协议,高性能锁
Project URL

Project URL

https://github.com/cyejing/dsync
Source Code Management

Source Code Management

https://github.com/cyejing/dsync

Download dsync

Filename Size
dsync-0.1.3.pom 4 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/cn.cyejing/dsync/ -->
<dependency>
    <groupId>cn.cyejing</groupId>
    <artifactId>dsync</artifactId>
    <version>0.1.3</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/cn.cyejing/dsync/
implementation 'cn.cyejing:dsync:0.1.3'
// https://jarcasting.com/artifacts/cn.cyejing/dsync/
implementation ("cn.cyejing:dsync:0.1.3")
'cn.cyejing:dsync:pom:0.1.3'
<dependency org="cn.cyejing" name="dsync" rev="0.1.3">
  <artifact name="dsync" type="pom" />
</dependency>
@Grapes(
@Grab(group='cn.cyejing', module='dsync', version='0.1.3')
)
libraryDependencies += "cn.cyejing" % "dsync" % "0.1.3"
[cn.cyejing/dsync "0.1.3"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • dsync-toolkit
  • dsync-dominate
  • dsync-common
  • dsync-example

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. 添加依赖
<dependency>
  <groupId>cn.cyejing</groupId>
  <artifactId>dsync-toolkit</artifactId>
</dependency>
  1. 使用方法
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();
}

Versions

Version
0.1.3
0.1.2