I got the following problem:
I want to use the mediator pattern for an app.
I got a producer that creates values. I got a mediator that stores the values in a queue(which is private, so getters and setters exist) and notifices the consumer that there are new values in the queue. I got the consumer, that gets notified about a new value, gets it and does stuff with it...
I want all 3 classes to run on own threads. But I also want to be efficient.
If I understand it right, my mediator thread will be GCed when run() ends... so I would need to keep it alive by a loop, don't I? Like while(true), but this is not very efficient. Is there a better way? Or am I totally incorrect and the mediator wouldn't be GCed?
Thanks in advance