Skip to content

Commit

Permalink
enhance: add zone id class cache
Browse files Browse the repository at this point in the history
  • Loading branch information
lo1nt committed Aug 6, 2024
1 parent dfcbd72 commit 95d0e3f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/java/com/caucho/hessian/io/SerializerFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -760,12 +760,20 @@ protected static void addAbstractStringBuilderSupport() {
}
}

private static boolean isZoneId(Class cl) {
private static Class<?> ZONE_ID_CLASS_CACHE = null;

static {
try {
return isHigherThanJdk8 && Class.forName("java.time.ZoneId").isAssignableFrom(cl);
ZONE_ID_CLASS_CACHE = Class.forName("java.time.ZoneId");
} catch (ClassNotFoundException e) {
// ignore
}
}

private static boolean isZoneId(Class cl) {
if (ZONE_ID_CLASS_CACHE != null) {
return isHigherThanJdk8 && ZONE_ID_CLASS_CACHE.isAssignableFrom(cl);
}
return false;
}
}

0 comments on commit 95d0e3f

Please sign in to comment.