I'm doing an uni project about a computer system intended to be used in an hospital.
I have a TreeSet
of Patient
, where all the patients recovered in the hospital are stored. The class Patient
has among other data some vital parameters associated to it.
In addition to the main thread, I have three threads that generate the vital parameters of every Patient
: I have a thread that generate blood pressure every 2 minutes, a thread that generate heartbeat every 5 minutes and a thread that generate temperature every 3 minutes.
In the threads I have a BlockingQueue<Patient> patients
, where every new Patient
is added by the Producer and the threads have to perform the action described above for each Patient
.
The problem is that I'm afraid I haven't quite understood the Producer-Consumer pattern.
My consumers are the three threads, but they are different types of classes, I have PressureChanger
, TemperatureChanger
, HeartBeatChanger
. If I add patients the first thread gets the first patient from the Queue, the second thread the second one and the third thread the third one and then if I insert other patients no threads get them.
How does it work with not only multiple Consumers, but also different classes who perform different actions, have different methods, as Consumers?