Think of a data base which handles data base resource pool where we need to effectively manage the resources based on the requirements.If there is a method like getResource() which returns a resource.If the resource is available in the pool,simply return the resource.If all resources are busy and you got request for resource,then we have to put the thread in sleep and put the thread reference in queue.Once the resource is available,get the thread reference from queue(FIFO) and wake up it and return resource.
http://www.javamex.com/tutorials/wait_notify_how_to.shtml
ReplyDelete