Prevent non thread-safe method to be used in multithreaded context (Java)
===

Is there a way to throw an exception when a user tries to use a non thread-safe method of a class in a multithreaded context? I guess the issue is mostly to detect that multiple threads are trying to use the method.