Skip to content

Commit

Permalink
fix(java): skip register unexisted skip class (#1601)
Browse files Browse the repository at this point in the history
## What does this PR do?

skip register unexisted skip class if `deserializeUnexistedClass` not
enabled

## Related issues
#1600 

## Does this PR introduce any user-facing change?

<!--
If any user-facing interface changes, please [open an
issue](https://github.com/apache/incubator-fury/issues/new/choose)
describing the need to do so and update the document if necessary.
-->

- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?


## Benchmark

<!--
When the PR has an impact on performance (if you don't know whether the
PR will have an impact on performance, you can submit the PR first, and
if it will have impact on performance, the code reviewer will explain
it), be sure to attach a benchmark data here.
-->
  • Loading branch information
chaokunyang committed May 5, 2024
1 parent 48361cb commit bf7f364
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,19 @@ private void addDefaultSerializers() {
if (fury.getConfig().registerGuavaTypes()) {
GuavaCollectionSerializers.registerDefaultSerializers(fury);
}
if (metaContextShareEnabled) {
addDefaultSerializer(
UnexistedMetaSharedClass.class, new UnexistedClassSerializer(fury, null));
// Those class id must be known in advance, here is two bytes, so
// `UnexistedClassSerializer.writeClassDef`
// can overwrite written classinfo and replace with real classinfo.
short classId =
Objects.requireNonNull(classInfoMap.get(UnexistedMetaSharedClass.class)).classId;
Preconditions.checkArgument(classId > 63 && classId < 8192, classId);
} else {
register(UnexistedSkipClass.class);
if (fury.getConfig().deserializeUnexistedClass()) {
if (metaContextShareEnabled) {
addDefaultSerializer(
UnexistedMetaSharedClass.class, new UnexistedClassSerializer(fury, null));
// Those class id must be known in advance, here is two bytes, so
// `UnexistedClassSerializer.writeClassDef`
// can overwrite written classinfo and replace with real classinfo.
short classId =
Objects.requireNonNull(classInfoMap.get(UnexistedMetaSharedClass.class)).classId;
Preconditions.checkArgument(classId > 63 && classId < 8192, classId);
} else {
register(UnexistedSkipClass.class);
}
}
}

Expand Down

0 comments on commit bf7f364

Please sign in to comment.