Skip to content

Commit

Permalink
[Java] add jdk migration doc (#715)
Browse files Browse the repository at this point in the history
add migration doc
  • Loading branch information
chaokunyang authored Jul 21, 2023
1 parent c1597cf commit bc45b20
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions docs/guide/java_object_graph_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ title: Java Object Graph Guide
order: 0
-- fury_frontmatter -->

## Java object graph serialization
# Java object graph serialization
When only java object serialization needed, this mode will have better performance compared to cross-language object graph serialization.

### Quick Start
## Quick Start
```java
import java.util.List;
import java.util.Arrays;
Expand Down Expand Up @@ -54,7 +54,8 @@ public class Example {
}
```

### Advanced Fury Creation
## Advanced Usage
### Fury creation
Single thread fury:
```java
Fury fury = Fury.builder()
Expand Down Expand Up @@ -173,3 +174,15 @@ Object newObj = fury.execute(
Fury support deserializing unexisted classes, this feature can be enabled by `FuryBuilder#withDeserializeUnExistClassEnabled(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 returned.

## Migration
### JDK migration
If you use jdk serialization before, and you can't upgrade your client and server at the same time, which is common for online application. Fury provided an util method `io.fury.serializer.JavaSerializer.serializedByJDK` to check whether the binary are generated by jdk serialization, you use following pattern to make exiting serialization protocol-aware, then upgrade serialization to fury in an async rolling-up way:
```java
if (JavaSerializer.serializedByJDK(bytes)) {
ObjectInputStream objectInputStream = xxx;
return objectInputStream.readObject();
} else {
return fury.deserialize(bytes);
}
```

0 comments on commit bc45b20

Please sign in to comment.