tat2dlady 0 Light Poster

I have an assignment that I need to do that designs the necessary classes to facilitate an indirect blocking and non-blocking communication environment between threads (producers and consumers) using a bounded buffer whose size is defined at run time. I am to test the working of these classes by creating an environment where 2 producers and 2 consumers communicate with each other by arbitrarily choosing either blocking or non-blocking mode.

I also have to design the necessary classes to implement an emulated direct blocking and non-blocking communication between threads through a bounded buffer whose size is defined at run time. What this means is though the communication appears to be direct, in actual terms, it is implemented through a bounded buffer.

Does anyone know how to implement these examples in Java? I do not know Java but I get the concept of OOP. I do have pieces of code for creating the bounded buffer, the threads, and the mailbox (from my text boook).

One question I have is how do you ensure that the info sent by a particular producer for a particular consumer is delivered to that consumer? And be able to block until that is done? How do you match up the message from the producer to the consumer?

I am not sure how to implement the blocking or non-blocking methods. Thanks for any input anyone may have. It would be greatly appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.