Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: lock demo #783

Merged
merged 8 commits into from
Sep 26, 2022
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions docs/zh/start/lock/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,45 @@ client2 succeeded in unlocking
Demo success!
```

#### **Java**

下载 java sdk 和示例代码:

```shell @if.not.exist java-sdk
git clone https://github.com/layotto/java-sdk
```

切换目录:

```shell
cd java-sdk
```

构建:

```shell @if.not.exist examples-sequencer/target/examples-lock-1.2.0-SNAPSHOT-jar-with-dependencies.jar
seeflood marked this conversation as resolved.
Show resolved Hide resolved
# build example jar
mvn -f examples-lock/pom.xml clean package
```

运行:

```shell
java -jar examples-lock/target/examples-lock-1.2.0-SNAPSHOT-jar-with-dependencies.jar
```

打印出以下信息说明运行成功:

```bash
TryLockResponse{success=true}
TryLockResponse{success=true}
TryLockResponse{success=true}
UnlockResponse{status=SUCCESS}
TryLockResponse{success=true}
UnlockResponse{status=LOCK_UNEXIST}
```


### 下一步
#### 这个客户端程序做了什么?
示例客户端程序中使用了Layotto提供的golang版本sdk,调用Layotto 分布式锁API,启动多个协程进行抢锁、解锁操作。
Expand Down