Hi, Thank you for your reply. It is very useful, will save CPU and GC times.
For sending, I already synchronize calling "onNext()" on the outbound stream observer, since sending may happen directly if isReady() is true(by the caller thread) or via the setOnReadyHandler() Runnable, i.e. some thread from Netty's executor service. There were different errors (on the server and clients) without synchronizing onNext(). Regards On Wednesday, February 2, 2022 at 10:52:17 PM UTC+2 [email protected] wrote: > Yes, all protobuf v3 messages and immutable in Java so it's thread-safe to > be used concurrently. (Note that you should not send concurrent messages > over the same stream, because that will corrupt the data that grpc is > sending out.) > > On Sunday, January 30, 2022 at 7:43:36 AM UTC-8 [email protected] wrote: > >> Hi, >> >> We have a bi-di streaming service, the server is in gRPC Java. >> >> Many of the server-side ProtoBuf messages are immutable, i.e. can be >> created once and sent to all client channels. Right now new instance is >> created and sent to each client. >> >> Is sending the same ProtoBuf message, concurrently, to multiple outbound >> streams possible and thread-safe thing to do? >> >> >> Thanks >> > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/72873cb2-15b3-4cb4-b163-af16c72e6057n%40googlegroups.com.
