Use Thread.current instead of a class_attribute for thread safety