The java document says the append method is thread safe. However, I remember that when I tried to add to the text area from different streams (several months ago), I get mixed text in which stream 1 will add some characters, and in stream 2 some other characters will be added. So instead of getting STRINGstring in jtextarea, I get SstTrRINingG.
What differences may be between:
- add sync
- bottlenecking is added from different threads through threadpoolexecutor.
- using invokeLater on EDT
Or are they all suitable for fixing the problem? Thanks
source
share