Synchronized Drag and Drop?!?

All game events happen on the game thread.
All gui events happen on event dispatch thread, as far as i know.

Lets say I want do drag and drop. i.e. drag an item in my inventory to my equipment.

Exporting involves getting game data. However, since exporting happens on the EDT, a race condition is possible. The same applies with importing.

My solution is to:

  1. Ignore race conditions and delay data manipulation until later.

  2. Push that final code to the game loop with something like this:


Game.invokeLater(Runnable run);

  1. Re-check and continue/change data if everything is good

Only issue is this method:


public boolean importData(TransferHandler.TransferSupport support);

This the final import code. What should I return? Since I am offloading the actual import code to the game loop, there is no way for me to know if I am still importing data.