[grpc-io] Re: StreamObservers in multi-thread Java application

2023-09-18 Thread Quyen Pham Ngoc
Thanks for your help. I found a class that ensures synchronization of StreamObserver methods. Link: https://github.com/stargate/stargate public class SynchronizedStreamObserver implements StreamObserver { private final StreamObserver streamObserver; public

[grpc-io] Re: StreamObservers in multi-thread Java application

2023-09-15 Thread 'Terry Wilson' via grpc.io
Yes, you should not have two threads calling onNext() on the same StreamObserver. If you do, you can get messages interleaved with each other and most likely just produce garbage. You need to make sure that your application acquires a lock before calling any of the methods on StreamObserver.