https://bz.apache.org/bugzilla/show_bug.cgi?id=58058
Bug ID: 58058 Summary: Library _instance needs to be volatile Product: Tomcat Native Version: unspecified Hardware: PC OS: Mac OS X 10.4 Status: NEW Severity: normal Priority: P2 Component: Library Assignee: dev@tomcat.apache.org Reporter: s...@apache.org The static field Library._instance is mutable but access is not synchronised and the field is not volatile. There is no guarantee that the write by one thread will be seen by another in a timely manner (or at all) - i.e. the field is not safely published. The other fields are also not safely published for the same reason. Possible consequences: - init can be performed more than once - reader thread may see partial setup of static variables Making the _instance field volatile would prevent double init, but would not ensure safe publication of the other static fields. Otherwise the Library class is only safe to use from a single thread. It's possible that one could use some form of IODH (*) to avoid the need for synch. (*) https://en.wikipedia.org/wiki/Initialization-on-demand_holder_idiom -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org