Last time, I talked about the Marsupilami Pattern, where we introduce queues to transport data between application layers.
But what if the Indian Train enters into the UI Thread? What if your user clicks on the menu bar, and the mouse events ends up at the end of the train. Would he want to use program where menus take several seconds to appear?
Or what if the Indian Train gets sent on the network? It might impact all the other applications sharing the network with yours, and they might not be happy playing the role of those sacred cows watching the Indian Train pass.
But what is to be done? Your Display class, for instance, is quite straightforward:
public class Display {
public void show(Data data) {
SwingUtilities.invokeLater(() -> table.addRow(data));
}
}
}
Data is received, data is displayed. So simple. But sometimes, simplicity is too naive. One possible solution is to use the Indiana Jones Pattern. Wait for it!
No comments:
Post a Comment