Yahoo Interview Question
179 Interview Reviews |
Back to all Yahoo Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Engineer at Yahoo:
Helpful Question?
Yes |
No
Inappropriate?
Answers & Comments (1)
Members can
answer or comment on this question
–
Join Now (It's Free) or
Sign In
0 of 0 people found this helpful
by neakor:
Make the desired singleton class extend ThreadLocal and override the lazy initialization initialValue() method.
If the class is not allowed, using a ConcurrentHashMap with the Thread as key and the singleton class instance as value.
If not using Java, i think c++ has a built-in thread local keyword that can mark the class thread local.