You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by GitBox <gi...@apache.org> on 2021/02/16 21:06:43 UTC

[GitHub] [httpcomponents-core] garydgregory opened a new pull request #263: Let TimeValue convert to and from Duration.

garydgregory opened a new pull request #263:
URL: https://github.com/apache/httpcomponents-core/pull/263


   Java 8 delivers the `java.time` package including the `Duration` class which is a nice way to express timeouts, just like our `TimeValue` and `Timeout` classes. Therefore, this PRs allows conversions between our types and a Java Duration for use cases where an application already deals with Durations.
   
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] garydgregory merged pull request #263: Let TimeValue/Timeout convert to and from Duration.

Posted by GitBox <gi...@apache.org>.
garydgregory merged pull request #263:
URL: https://github.com/apache/httpcomponents-core/pull/263


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] garydgregory commented on pull request #263: Let TimeValue/Timeout convert to and from Duration.

Posted by GitBox <gi...@apache.org>.
garydgregory commented on pull request #263:
URL: https://github.com/apache/httpcomponents-core/pull/263#issuecomment-780913303


   @michael-o 
   I'm not so sure there is a case of a cache here. There would be two possibilities:
   - Cache known values like `Long`, `Short` and `Integer` do.
   - An MRU cache.
   
   I think I'll merge this PR and we can discuss this on the ML if you care to push it forward.
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] michael-o commented on pull request #263: Let TimeValue/Timeout convert to and from Duration.

Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #263:
URL: https://github.com/apache/httpcomponents-core/pull/263#issuecomment-780855558


   @garydgregory I agree now on `TimeValue` and `Duration`. Read both Javadocs. Does it make sense to maintain a `Timeout` which is just a catch for non-negative values?


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] michael-o edited a comment on pull request #263: Let TimeValue/Timeout convert to and from Duration.

Posted by GitBox <gi...@apache.org>.
michael-o edited a comment on pull request #263:
URL: https://github.com/apache/httpcomponents-core/pull/263#issuecomment-780565749


   Let me go through to understand your position...


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] michael-o commented on pull request #263: Let TimeValue/Timeout convert to and from Duration.

Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #263:
URL: https://github.com/apache/httpcomponents-core/pull/263#issuecomment-780565749


   > 
   > 
   > Hi @michael-o ,
   > 
   > I think we might have our signals crossed on the concepts:
   > 
   >     * A `TimeValue` is **not** an instant. A `TimeValue` is an amount of time, I should have been clearer in the Javadoc, for example, "5 SECONDS".  So yes, it is equivalent to a `java.time.Duration`.
   > 
   >     * A `Timeout` is a specialization of a `TimeValue` to allow APIs to specify that an argument is represents the concept of "timeout" instead of a "plain" amount of time.
   > 
   >     * An instant, like a Java `Instant` is a point in the time-line like "January 16, 2010 at 17:27 PM UTC".
   > 
   >     * Java 8 provides further refinements like `Period`, so you can express concepts like "one a day", "once a week", "once a month", and so on.
   > 
   > 
   > If we had started 5.0 on Java 8, I probably would not have added `TimeValue` and `Timeout`, but maybe... too late now ;-) I might have done so as a `Duration` wrapper since `Duration` is final. It's still nice to have a `Timeout` class I think. In fact I have `TimeValue` redone as a `Duration` wrapper in a local git stash, but it's not 100% there yet.
   
   Let me go through to understand your position...


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] michael-o commented on pull request #263: Let TimeValue/Timeout convert to and from Duration.

Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #263:
URL: https://github.com/apache/httpcomponents-core/pull/263#issuecomment-780131185


   Do you consider `Duration` to be semantically equivalent to both? Duration describes a continuous space of time while:
   * Timeout a descrete event
   * TimeValue an instant


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-core] garydgregory commented on pull request #263: Let TimeValue/Timeout convert to and from Duration.

Posted by GitBox <gi...@apache.org>.
garydgregory commented on pull request #263:
URL: https://github.com/apache/httpcomponents-core/pull/263#issuecomment-780163476


   Hi @michael-o ,
   
   I think we might have our signals crossed on the concepts: 
   
   - A `TimeValue` is **not** an instant. A `TimeValue` is an amount of time, I should have been clearer in the Javadoc, for example, "5 SECONDS".  So yes, it is equivalent to a `java.time.Duration`. 
   - A `Timeout` is a specialization of a `TimeValue` to allow APIs to specify that an argument is represents the concept of "timeout" instead of a "plain" amount of time.
   - An instant, like a Java `Instant` is a point in the time-line like "January 16, 2010 at 17:27 PM UTC".
   - Java 8 provides further refinements like `Period`, so you can express concepts like "one a day", "once a week", "once a month", and so on.
   
   If we had started 5.0 on Java 8, I probably would not have added `TimeValue` and `Timeout`, but maybe... too late now ;-) I might have done so as a `Duration` wrapper since `Duration` is final. It's still nice to have a `Timeout` class I think. In fact I have `TimeValue` redone as a `Duration` wrapper in a local git stash, but it's not 100% there yet.
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org