This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-fury-site.git
The following commit(s) were added to refs/heads/main by this push:
new 2c3f377 🔄 synced local 'docs/guide/' with remote 'docs/guide/'
2c3f377 is described below
commit 2c3f3772563e0db388a13e618d7dca7d73557a3f
Author: chaokunyang <[email protected]>
AuthorDate: Mon Mar 4 02:34:44 2024 +0000
🔄 synced local 'docs/guide/' with remote 'docs/guide/'
---
docs/guide/java_object_graph_guide.md | 58 ++++++++++++++++++-----------------
1 file changed, 30 insertions(+), 28 deletions(-)
diff --git a/docs/guide/java_object_graph_guide.md
b/docs/guide/java_object_graph_guide.md
index 76c889c..9cbe08b 100644
--- a/docs/guide/java_object_graph_guide.md
+++ b/docs/guide/java_object_graph_guide.md
@@ -122,7 +122,7 @@ public class Example {
Single thread fury:
```java
-Fury fury=Fury.builder()
+Fury fury = Fury.builder()
.withLanguage(Language.JAVA)
// enable reference tracking for shared/circular reference.
// Disable it will have better performance if no duplicate reference.
@@ -134,14 +134,14 @@ Fury fury=Fury.builder()
// enable async multi-threaded compilation.
.withAsyncCompilation(true)
.build();
- byte[]bytes=fury.serialize(object);
+ byte[] bytes = fury.serialize(object);
System.out.println(fury.deserialize(bytes));
```
Thread-safe fury:
```java
-ThreadSafeFury fury=Fury.builder()
+ThreadSafeFury fury = Fury.builder()
.withLanguage(Language.JAVA)
// enable reference tracking for shared/circular reference.
// Disable it will have better performance if no duplicate reference.
@@ -157,7 +157,7 @@ ThreadSafeFury fury=Fury.builder()
// enable async multi-threaded compilation.
.withAsyncCompilation(true)
.buildThreadSafeFury();
- byte[]bytes=fury.serialize(object);
+ byte[] bytes = fury.serialize(object);
System.out.println(fury.deserialize(bytes));
```
@@ -239,14 +239,14 @@ Note that class registration order is important,
serialization and deserializati
should have same registration order.
```java
-Fury fury=xxx;
+Fury fury = xxx;
fury.register(SomeClass.class);
fury.register(SomeClass1.class, 200);
```
If you invoke `FuryBuilder#requireClassRegistration(false)` to disable class
registration check,
you can set `org.apache.fury.resolver.ClassChecker` by
`ClassResolver#setClassChecker` to control which classes are allowed
-for serialization. For example,you can allow classes started with
`org.example.*` by:
+for serialization. For example, you can allow classes started with
`org.example.*` by:
```java
Fury fury = xxx;
fury.getClassResolver().setClassChecker((classResolver, className) ->
className.startsWith("org.example."));
@@ -315,40 +315,42 @@ forward/backward compatibility automatically.
// // share meta across serialization.
// .withMetaContextShare(true)
// Not thread-safe fury.
-MetaContext context=xxx;
- fury.getSerializationContext().setMetaContext(context);
- byte[]bytes=fury.serialize(o);
+MetaContext context = xxx;
+fury.getSerializationContext().setMetaContext(context);
+byte[] bytes = fury.serialize(o);
// Not thread-safe fury.
- MetaContext context=xxx;
- fury.getSerializationContext().setMetaContext(context);
- fury.deserialize(bytes)
+MetaContext context = xxx;
+fury.getSerializationContext().setMetaContext(context);
+fury.deserialize(bytes)
// Thread-safe fury
- fury.setClassLoader(beanA.getClass().getClassLoader());
- byte[]serialized=fury.execute(
- f->{
- f.getSerializationContext().setMetaContext(context);
- return f.serialize(beanA);
- });
+fury.setClassLoader(beanA.getClass().getClassLoader());
+byte[] serialized = fury.execute(
+ f -> {
+ f.getSerializationContext().setMetaContext(context);
+ return f.serialize(beanA);
+ }
+);
// thread-safe fury
- fury.setClassLoader(beanA.getClass().getClassLoader());
- Object newObj=fury.execute(
- f->{
- f.getSerializationContext().setMetaContext(context);
- return f.deserialize(serialized);
- });
+fury.setClassLoader(beanA.getClass().getClassLoader());
+Object newObj = fury.execute(
+ f -> {
+ f.getSerializationContext().setMetaContext(context);
+ return f.deserialize(serialized);
+ }
+);
```
### Deserialize un-exited classes.
-Fury support deserializing Unexisted classes, this feature can be enabled
+Fury support deserializing unexisted classes, this feature can be enabled
by `FuryBuilder#deserializeUnexistedClass(true)`. When enabled, and metadata
sharing enabled, Fury will store
the deserialized data of this type in a lazy subclass of Map. By using the
lazy map implemented by Fury, the rebalance
cost of filling map during deserialization can be avoided, which further
improves performance. If this data is sent to
another process and the class exists in this process, the data will be
deserialized into the object of this type without
losing any information.
-If metadata sharing is not enabled, the new class data will be skipped and a
UnexistedSkipClass stub object will be
+If metadata sharing is not enabled, the new class data will be skipped and an
`UnexistedSkipClass` stub object will be
returned.
## Migration
@@ -361,8 +363,8 @@ the binary are generated by jdk serialization, you use
following pattern to make
then upgrade serialization to fury in an async rolling-up way:
```java
-if(JavaSerializer.serializedByJDK(bytes)){
- ObjectInputStream objectInputStream=xxx;
+if (JavaSerializer.serializedByJDK(bytes)) {
+ ObjectInputStream objectInputStream = xxx;
return objectInputStream.readObject();
} else {
return fury.deserialize(bytes);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]