Just seeking some confirmation on something:
I have a server object with Swing GUI, containing a method handle()
, which is accessed by external threads, and another method doThis()
, which is run from the server object's GUI.
I understand that Swing event handling takes place on the event dispatch thread, so it's actually the event dispatch thread that accesses doThis()
.
There is a possibility that doThis()
and handle()
will result in interference. To avoid that, I should make both methods synchronized right? This will prevent the event dispatch thread and the other external threads from calling one method before the other is completed.
Is my reasoning correct?