RFR: 8003246: Add Supplier to ThreadLocal

Doug Lea dl at cs.oswego.edu
Thu Dec 6 17:38:34 UTC 2012

On 12/06/12 12:01, Akhil Arora wrote:

> redone - http://cr.openjdk.java.net/~akhil/8003246.1/webrev/

Much better; thanks!
As a minor matter, it probably makes sense to give that class a
name. Even though it is a non-public static class, the name
will be seen here and there by debuggers, stacktraces, etc,
and the default "$" name will be confusing. As in:

static final class SuppliedThreadLocal<T> extends ThreadLocal<T> ..

public static <T> ThreadLocal<T> withInitial(Supplier<? extends T> supplier) {
    return new SuppliedThreadLocal<T>(supplier);

More information about the core-libs-dev mailing list