InheritableThreadLocal

Introduction

The Java InheritableThreadLocal class extends ThreadLocal to provide inheritance of values from parent thread to child thread: when a child thread is created, the child receives initial values for all inheritable thread-local variables for which the parent has values.

Class Declaration

Following is the declaration for java.lang.InheritableThreadLocal class −

publicclassInheritableThreadLocal<T>extendsThreadLocal<T>

Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your career.

Class constructors

S.N.Constructor & Description
1public class InheritableThreadLocal<T>extends ThreadLocal<T>This is the Single Constructor.

Class methods

S.N.Method & Description
1protected T childValue(T parentValue)This method computes the child’s initial value for this inheritable thread-local variable as a function of the parent’s value at the time the child thread is created.

Methods inherited

This class inherits methods from the following classes −

  • java.lang.ThreadLocal
  • java.lang.Object

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *