1.

What Are Possible Use Cases For Java.lang.threadlocal?

Answer»

Instances of ThreadLocal can be used to transport information THROUGHOUT the application WITHOUT the need to PASS this from method to method. Examples would be the TRANSPORTATION of security/login information within an INSTANCE of ThreadLocal such that it is accessible by each method. Another use case would be to transport transaction information or in general objects that should be accessible in all methods without passing them from method to method.

Instances of ThreadLocal can be used to transport information throughout the application without the need to pass this from method to method. Examples would be the transportation of security/login information within an instance of ThreadLocal such that it is accessible by each method. Another use case would be to transport transaction information or in general objects that should be accessible in all methods without passing them from method to method.



Discussion

No Comment Found