david.lloyd at redhat.com
Wed Jun 6 14:27:44 EDT 2018
On Wed, Jun 6, 2018 at 1:17 PM, Peter Levart <peter.levart at gmail.com> wrote:
> Or there could simply be the following method in ThreadLocal:
> * @return true if current thread has a value present for this thread-local
> variable; false if not.
> public boolean isPresent()
> Would that be preferable?
That would work assuming no ThreadLocal subclasses have such a method.
Adding an instance method to a class that can be subclassed is always
a risk in this way.
More information about the Concurrency-interest