Question: JAVA PROBLEM Simulate an online shop. The shop has many products, each product having a quantity in stock. Clients (threads) send requests specifying the product

JAVA PROBLEM JAVA PROBLEM Simulate an online shop. The shop has many products, each

Simulate an online shop. The shop has many products, each product having a quantity in stock. Clients (threads) send requests specifying the product name and quantity. The requests are sent to a waiting queue. Employees (threads) take requests from the queue and check the stock. The stock is a shared Map, where the key is the product name and the value is the quantity in stock. If there are enough products in the stock then the employee prints that the request was fulfilled and the products are subtracted from the stock. If not the employee prints that the request cannot be fulfilled. In main test the program with 10 clients, each sending 10 requests and 5 employees. Solve the concurrent access to shared resources using objects lock, wait and notify

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!