Register now or log in to join your professional community.
A good way to implement such a mechanism is to use a queue, for example a thread safe BlockingQueueand have2 consumer threads:
Then your T0...T10 simply put jobs in one of the queues and wait (or not) for them to be executed when the Printer/Scanner is ready.
By doing that you remove the need to lock on the client/producer side and let the consumer side (Printer and Scanner) to manage their jobs.
You should not call wait() methods inside the resource. Should not call the other resources inside the resource.