0

I have generated java protobuf class. This class has protobuf extensions also. Is it safe to modify different unrelated fields and extensions of the same protobuf builder in parallel?

message TopMessage {
  FirstLeaf firstLeaf = 1;
  SecondLeaf secondLeaf = 2;
final var topBuilder = TopMessage.newBuilder();
CompletableFuture.supplyAsync(() -> buildFirstLeaf(topBuilder));
CompletableFuture.supplyAsync(() -> buildSecondLeaf(topBuilder));
// wait for completion and return topBuilder.build();
1
  • 1
    Not a Java dev. TopMessage is a regular Java object once you've used protoc to compile the Protobuf to Java. There are (un)marshaling methods but, as long as your Java object is correct before e.g. marshaling, there should be no issues paralellizing mutations. Commented May 7 at 22:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.