Package org.eclipse.lsp4j.jsonrpc.json
Class ConcurrentMessageProcessor
- java.lang.Object
-
- org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor
-
- All Implemented Interfaces:
java.lang.Runnable
public class ConcurrentMessageProcessor extends java.lang.Object implements java.lang.RunnableThis class connects a message producer with a message consumer by listening for new messages in a dedicated thread.
-
-
Constructor Summary
Constructors Constructor Description ConcurrentMessageProcessor(MessageProducer messageProducer, MessageConsumer messageConsumer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.concurrent.Future<java.lang.Void>beginProcessing(java.util.concurrent.ExecutorService executorService)Start a thread that listens for messages in the message producer and forwards them to the message consumer.protected voidprocessingEnded()protected voidprocessingStarted()voidrun()static java.util.concurrent.Future<java.lang.Void>startProcessing(MessageProducer messageProducer, MessageConsumer messageConsumer, java.util.concurrent.ExecutorService executorService)Deprecated.Please use the non-staticbeginProcessing(java.util.concurrent.ExecutorService)instead.static java.util.concurrent.Future<java.lang.Void>wrapFuture(java.util.concurrent.Future<?> result, MessageProducer messageProducer)
-
-
-
Constructor Detail
-
ConcurrentMessageProcessor
public ConcurrentMessageProcessor(MessageProducer messageProducer, MessageConsumer messageConsumer)
-
-
Method Detail
-
startProcessing
@Deprecated public static java.util.concurrent.Future<java.lang.Void> startProcessing(MessageProducer messageProducer, MessageConsumer messageConsumer, java.util.concurrent.ExecutorService executorService)
Deprecated.Please use the non-staticbeginProcessing(java.util.concurrent.ExecutorService)instead.Start a thread that listens for messages in the message producer and forwards them to the message consumer.- Parameters:
messageProducer- - produces messages, e.g. by reading from an input channelmessageConsumer- - processes messages and potentially forwards them to other consumersexecutorService- - the thread is started using this service- Returns:
- a future that is resolved when the started thread is terminated, e.g. by closing a stream
-
wrapFuture
public static java.util.concurrent.Future<java.lang.Void> wrapFuture(java.util.concurrent.Future<?> result, MessageProducer messageProducer)
-
beginProcessing
public java.util.concurrent.Future<java.lang.Void> beginProcessing(java.util.concurrent.ExecutorService executorService)
Start a thread that listens for messages in the message producer and forwards them to the message consumer.- Parameters:
executorService- - the thread is started using this service- Returns:
- a future that is resolved when the started thread is terminated, e.g. by closing a stream
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
processingStarted
protected void processingStarted()
-
processingEnded
protected void processingEnded()
-
-