api: Add java.time.Duration overloads to CallOptions, AbstractStub#11562
api: Add java.time.Duration overloads to CallOptions, AbstractStub#11562kannanjgithub merged 37 commits intogrpc:masterfrom
Conversation
…h Duration" This reverts commit ab97045.
|
|
| } | ||
|
|
||
| public static Deadline after(Duration duration, Ticker ticker) { | ||
| return after(TimeUnit.NANOSECONDS.convert(duration.getSeconds(), TimeUnit.SECONDS), |
There was a problem hiding this comment.
I have a concern about the loss of precision, I have raised a question on Eric's comment to use TimeUnit.NANOSECONDS.convert(duration) instead of Duration.toNano().
There was a problem hiding this comment.
As Eric replied, you should be using https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/TimeUnit.html#convert(java.time.Duration) and not have to convert using the seconds value.
|
|
||
| import java.time.Duration; | ||
|
|
||
| @Internal |
There was a problem hiding this comment.
@internal is used to mark certain classes as should not be used by user code. This class being just a util helper, there is no need to mark it as Internal. Also drop the Internal prefix from the class and file name and make it just TimeUtils.
There was a problem hiding this comment.
Well, this is public in a public package, so the @Internal is needed.
ejona86
left a comment
There was a problem hiding this comment.
We need @ExperimentalApi on all the new public API methods (those receiving Duration).
|
|
||
| import java.time.Duration; | ||
|
|
||
| @Internal |
There was a problem hiding this comment.
Well, this is public in a public package, so the @Internal is needed.
…ving Duration and reverted LoadBalancer code.
| return new ScheduledHandle(runnable, future); | ||
| } | ||
|
|
||
| @ExperimentalApi("https://github.com/grpc/grpc-java/issues/10245") |
There was a problem hiding this comment.
These links should point to a new issue created to track stabilizing this API. (See issues with the "experimental API" label for examples.)
Overloading API's containing long, TimeUnit with java.time.Duration
Fixes #10245