On Sat, 15 May 2021 21:32:54 GMT, Ralph Goers 
<github.com+120415+rgo...@openjdk.org> wrote:

>> 8266846: Add java.time.InstantSource
>
> Can you possibly find a way that this can be used in a garbage free manner?  
> Providing a MutableInstant interface that allows the Instant object to be 
> provided and have its values set by a currentInstant(MutableInstant instant) 
> method would solve the problem nicely for Log4j - or any other app that is 
> trying to avoid allocating new objects. I believe this also aligns with what 
> [Michael Hixson](https://github.com/michaelhixson) is asking for.
> 
> An alternative would be for java.time to maintain a pool of Instants that 
> apps like Log4j can somehow control, but that would seem far more complicated.

@rgoers Michael's request has been handled, which was a simple change to the 
wording. What you need cannot be accomplished because `Instant` has a 
restricted design due to the Valhalla project.

A `MutableInstant` class can have its own `now()` method that does whatever is 
necessary to initialize it, so there is no need to refer to it here.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4016

Reply via email to