Skip to content

Commit 012f439

Browse files
authored
Update documentation
Updated documentation based on questions asked in #775 and #770.
1 parent 0645634 commit 012f439

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

documentation/README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ if (myImpl instanceof LanguageClientAware) {
3333

3434
Now your language server is not only able to receive messages from the other side, but can send messages back as well.
3535

36-
The final thing you need to to do in order to start listening on the given inputstream, is this:
36+
The final thing you need to to do in order to start listening on the given `inputstream`, is this:
3737

3838
``` java
39-
launcher.startListening();
39+
Future<Void> future = launcher.startListening();
4040
```
4141

42-
This will start the listening process in a new thread.
42+
This will start the listening process in a new thread that reads messages from the input stream and dispatches them to the corresponding message handlers.
43+
44+
When implementing the handlers for requests or notifications, you need to be aware that the calling thread is the thread that reads and dispatches incoming messages. Therefore, blocking it may result in reduced throughput or even a deadlock (https://github.com/eclipse-lsp4j/lsp4j/issues/775). As a general rule, message handlers should be implemented in a non-blocking, asynchronous way.
45+
46+
To stop listening for incoming messages, call `future.cancel(true)` (https://github.com/eclipse-lsp4j/lsp4j/issues/770).
4347

4448
# Extending the Protocol
4549

0 commit comments

Comments
 (0)