Extending java's ThreadLocal to allow the values to be reset across all threads
问题 After looking at this question, I think I want to wrap ThreadLocal to add a reset behavior. I want to have something similar to a ThreadLocal, with a method I can call from any thread to set all the values back to the same value. So far I have this: public class ThreadLocalFlag { private ThreadLocal<Boolean> flag; private List<Boolean> allValues = new ArrayList<Boolean>(); public ThreadLocalFlag() { flag = new ThreadLocal<Boolean>() { @Override protected Boolean initialValue() { Boolean value