From 9aa0b4e89e240efe2d5c7ec17b6f2cd48ea2e021 Mon Sep 17 00:00:00 2001 From: Qing Wang Date: Tue, 8 Mar 2022 14:36:08 +0800 Subject: [PATCH] [Java] Add transient for cached hashcode of IDs to reduce serialized size. (#22766) Use `transient` keyword for reducing the serialized size of ids for transporting. --- java/api/src/main/java/io/ray/api/id/BaseId.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/api/src/main/java/io/ray/api/id/BaseId.java b/java/api/src/main/java/io/ray/api/id/BaseId.java index ee91a77d63c4..e6a827df8af7 100644 --- a/java/api/src/main/java/io/ray/api/id/BaseId.java +++ b/java/api/src/main/java/io/ray/api/id/BaseId.java @@ -8,8 +8,8 @@ public abstract class BaseId implements Serializable { private static final long serialVersionUID = 8588849129675565761L; private final byte[] id; - private int hashCodeCache = 0; - private Boolean isNilCache = null; + private transient int hashCodeCache = 0; + private transient Boolean isNilCache = null; /** Create a BaseId instance according to the input byte array. */ protected BaseId(byte[] id) {