Is the swing repeat() method other than EDT in Java 7 still safe to use?
I know that even using swing's threading model, it was once considered safe to call repaint () and other methods from any thread, but recently I was told in my comments that this was not the case
Google has found many older discussions that it is safe, but not recently All the official references that once said safety seem to have disappeared. I found several people in various forums discussing how to no longer be safe
I can't find any official confirmation of whether it is or not - I really want to see something that explains the logic of change if it has changed This seems a very strange feature considering the risk of destroying existing applications
I am looking for an official reference link (i.e. Javadoc, Oracle tutorial or source code link) to indicate whether these methods can still be called from any thread
Refer to this question @ r_ 419_ 2472@:
Safe to use Component. repaint() outside EDT?
Quote from the now disappearing sun page:
This is in line with my understanding, but I can't find the page or any similar page now, and I have seen unconfirmed rumors from several people that it is no longer safe On the other hand, I don't have any clear statement. This function has changed
Change notes
What can help solve this problem is Oracle's official statement on swing thread processing changes I found the "changes in Java 7" page, but I didn't mention it at all. These pages didn't mention threads or EDT in any way:
http://docs.oracle.com/javase/7/docs/technotes/guides/swing/enhancements-7.html
http://docs.oracle.com/javase/7/docs/technotes/guides/awt/enhancements-7.html
Solution
This is the official reference:
And the redrawing method is not "otherwise specified"
To assure you again that you do not need to know the final answer better than the Javadoc of a single method, see, for example, the thread safety of recording methods in Java 6 Javadoc
to update
Obviously, more clarification is needed on the differences between normative norms, descriptive technical articles and specific implementation details Javadoc says that redrawing is not guaranteed to be a thread safe method Incidentally, the decision to delete the "thread safety" designation in most swing APIs often discussed in Java 7 is only the change of contract, not implementation
The implementation of redrawing in openjdk 7 seems thread safe, which has nothing to do with the guarantee given by the specification Thread - safe code or other method - dependent code is corrupted and cannot be guaranteed to work on all Java implementations