Skip to content

Commit 7ea0c3f

Browse files
Update README.md
1 parent f8110c6 commit 7ea0c3f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Diff for: README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ can talk to each other.
4747

4848
Add the following dependency to your build
4949
```text
50-
io.github.alexarchambault.libdaemon::libdaemon:0.0.3
50+
io.github.alexarchambault.libdaemon::libdaemon:0.0.5
5151
```
52-
The latest version is [![Maven Central](https://img.shields.io/maven-central/v/io.github.alexarchambault.libdaemon/libdaemon.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.alexarchambault.libdaemon/libdaemon).
52+
The latest version is [![Maven Central](https://img.shields.io/maven-central/v/io.github.alexarchambault.libdaemon/libdaemon_3.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.alexarchambault.libdaemon/libdaemon_3).
5353

5454
From the server, call `Lock.tryAcquire`, and start accepting connections on the server socket in the thunk passed to it:
5555
```scala
@@ -58,11 +58,16 @@ import java.nio.file._
5858

5959
val daemonDirectory: Path = ??? // pass a directory under the user home dir, computed with directories-jvm for example
6060
val lockFiles = LockFiles.under(daemonDirectory, "my-app-name\\daemon") // second argument is the Windows named pipe path (that doesn't live in the file system)
61-
Lock.tryAcquire(lockFiles) { serverSocket: Either[ServerSocket, ServerSocketChannel] =>
61+
val res = Lock.tryAcquire(lockFiles) { serverSocket: Either[ServerSocket, ServerSocketChannel] =>
6262
// serverSocket is a Right(…) when Java >= 16 Unix domain socket support is used,
6363
// it's Left(…) when ipcsocket JNI support is used
6464

6565
// you should start listening on serverSocket here, and as much as possible,
6666
// only exit this block when you are actually accepting incoming connections
6767
}
68+
res match {
69+
case Left(ex: LockError.RecoverableError) => // something went wrong, you may want to retry after a small delay
70+
case Left(ex: LockError.FatalError) => // something went wrong, retrying makes less sense here
71+
case Right(_) => // daemon is listening on Unix domain socket or Windows named pipe
72+
}
6873
```

0 commit comments

Comments
 (0)