5.2.x java time session and deadline#310
Conversation
ok2c
left a comment
There was a problem hiding this comment.
@garydgregory IOSession is a low level transport class. There are absolutely no benefit of using Instant for internal time representation in it. I see no point changing it. Deadline changes look good to me.
|
@garydgregory I also looked at the |
Newer versions of Java (like 11) provide nanosecond resolution. Not everyone is stuck on Java 8. |
|
Uh? Anyone can run our jar files on Java 11 and 17 and get the benefits. |
@garydgregory What would those be? Nanosecond time resolution for timeout calculation with 1s precision? |
The most important aspect of this type of change is type safety. On Java 8, we can use objects like Instant and Duration instead of a mix of int and long which appear unscaled and are subject to underflow, overflow, and wrap around behavior. Not to mention that sometimes an argument is expressed in seconds, sometimes it's in milliseconds, a sure recipe for bugs. |
@garydgregory This is a legitimate reason but not for low level classes where memory footprint matters more. If have spare cycles better invest them into porting high level APIs (such those in the cookie and cache packages) from |
From where I stand, consistency is important, as is the use of the better abstractions. I don't see evidence of memory footprint issues. I've not seen memory issues in this department in the past. There are lots of objects coming and going in a Java app, even a trivial one, and Java is getting better and better at managing memory on and off heap for object allocation. I brief, I don't see a real issue. |
c4a2881 to
fb864e2
Compare
a60a060 to
8561cbd
Compare
76dc849 to
912683c
Compare
fa9f5f8 to
f1bb865
Compare
1d68d86 to
e154468
Compare
Use Java 8's java.time package in sessions and deadlines.