Last time, I introduced the Indiana Jones Pattern, where you would filter your messages in order to send less data on your overcrowded queue.
This is more difficult than filtering, since you need to have access to your message queue and be able to remove messages from the middle. The default implementation of Thread Pools in Java uses queues that are optimized for adding at the end and removing from the front. Here, you will clearly need a different implementation.
public class Display {
public void run() {
while (true) {
Data data = queue.getNextMergeValue();
show(data);
}
}
}
}
After you filtered and merged all your data, you might end up running into the Water Drop Anti-Pattern. Next time!
No comments:
Post a Comment