This is the last example in the book, and I sure hope it helps me understand multithreading better than the other ones... Also while I remember: Texas Hold 'Em might be easier than I at first imagined, since, like 21 sticks (which I also realized is normally played with 1-4 sticks...oops!), it's (sort of) turn based. Nothing needs to happen simultaneously, so yay!
For now though, one more example on multithreading: A Network Application. From the text:
"The main purpose of this section is not to solve any particular problem but to show what an event is,
and how events can be handled in Java. It will also be an opportunity to look at some further aspects of multithreading in Java, as well as other features. So we are not going to create an actual application with real network nodes and connections, but instead build a small model application using objects to represent network nodes..."
TL;DR: Just going to be showing what can be done and how. No real app is going to be created, instead parts of the network will be represented by objects so we stay focused on the task at hand.
Got it? Basically, our faux-nodes will just be represented by an object that'll have its own thread to execute. The reason for that is just to mimic the independent and separate nature of multiple networks. When we start the application, it should have a number of listener objects, also complete with its own threads, to listen for messages from our network nodes, followed by whatever action its supposed to take.
1) Our "network nodes" will have threads
2) Start application
3) Action listeners in the application has a bunch of threads
4) When an action happens with the nodes, listener hears
5) Listener performs action based on event
There! I'm not even going to think "simple" this time, because wtf did I just write. However, in my usual style, I will leave this introductory section now, and start on the actual code tomorrow :P See you then!