georgereuben commented on code in PR #7689:
URL: https://github.com/apache/gravitino/pull/7689#discussion_r2206500675
##########
core/src/main/java/org/apache/gravitino/meta/AuditInfo.java:
##########
@@ -225,6 +226,12 @@ public Builder withLastModifiedTime(Instant
lastModifiedTime) {
* @return the constructed and validated {@link AuditInfo} instance.
*/
public AuditInfo build() {
+ AuditInfo auditInfo = new AuditInfo();
+ auditInfo.creator = this.creator;
+ auditInfo.createTime = this.createTime;
+ auditInfo.lastModifier = this.lastModifier;
+ auditInfo.lastModifiedTime = this.lastModifiedTime;
+
Review Comment:
> Another approach is to utilise the auditInfo instance and create a new one
after the assignment. That would be less code/changes, but I'm not sure that's
a better approach. What do you think?
Thanks for the feedback! I considered that approach initially, but I think
the current implementation is better for thread safet yand follows standard
builder patterns. Each `build()` call would create a completely independent
instance without side effects on the builder’s state. While it’s a few more
lines of code, I think it would be better in the long run.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]