tomaswolf commented on PR #76: URL: https://github.com/apache/mina-ftpserver/pull/76#issuecomment-2832634594
> creating a Date only if necessary. That's not what your code does. Besides, you've now introduced two synchronized methods. I think the approach is right, but this code is not. Try something like ``` public class DateHolder { private volatile long millis; public DateHolder() { this(System.currentTimeMillis()); } public DateHolder(long initial) { millis = initial; } public update() { millis = System.currentTimeMillis(); } public getDate() { return new Date(millis); } } ``` That's all you'd need. How about storing an AtomicLong in that attribute and just update that? Then you don't even need a custom class. Please try to avoid unrelated reformatting, it makes review difficult. -- 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: dev-unsubscr...@mina.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org