This is probably a broad question but I’d like to know where concurrency is typically used for a mono user desktop application. How do you spot a case (at design stage, ideally) where concurrency issues might arise?
P.S: From OS theory, I’d say concurrency issues usually take place when a resource can’t be shared (ex: printer). I’m still foggy on where this could take place on the programming level though.
There can be threading issues in Swing between the Event Dispatch thread and other logic.
It’s normally a bad idea to run long running code on the EDT since this means the user interface looks like it’s locked when it’s just waiting for code to run. The solution to this is to run long running code in a ProgressWorker which creates a new thread.
Here’s where we can get problems. If both the worker and the EventDispatch thread are changing things at the same time there can be concurrency issues (imagine looping over a list while another thread modifies it). This isn’t normally an issue however since good swing code will only modify Swing components from the Event Dispatch Thread anyway.