Skip to content

Commit

Permalink
[Java] Add transient for cached hashcode of IDs to reduce serialized …
Browse files Browse the repository at this point in the history
…size. (ray-project#22766)

Use `transient` keyword for reducing the serialized size of  ids for transporting.
  • Loading branch information
jovany-wang authored Mar 8, 2022
1 parent 7f57268 commit 9aa0b4e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions java/api/src/main/java/io/ray/api/id/BaseId.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9aa0b4e

Please sign in to comment.