Skip to content

docs: adding multi-threading clarifications for java serialization #2356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/guide/java_serialization_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ byte[] bytes = fory.serialize(object);
System.out.println(fory.deserialize(bytes));
```

Note that calling `buildThreadSafeFory()` on `ForyBuilder` will create an instance of `ThreadLocalFury`.
This may not be appropriate in environments where virtual threads are used, as each thread will create its own fury instance, a relatively expensive operation.
An alternative for virtual threads is to use `buildThreadSafeForyPool`.

### Handling Class Schema Evolution in Serialization

In many systems, the schema of a class used for serialization may change over time. For instance, fields within a class
Expand Down Expand Up @@ -1232,6 +1236,9 @@ Object newObj = fory.execute(
);
```

Note that `MetaContext` is not thread-safe and cannot be reused across instances of fory or multiple threads.
In cases of multi-threading, a separate `MetaContext` must be created for each fory instance.

### Deserialize non-existent classes

Fory support deserializing non-existent classes, this feature can be enabled
Expand Down
Loading