Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java You are asked to implement a message queue connector class using Java. The following figure depicts a message queue connector class, followed by

In Java

You are asked to implement a message queue connector class using Java. The following figure depicts a message queue connector class, followed by the detailed specifications of operations. The message queue connector class has send() and receive(), and the size of queue is 3.

To test your implementation, your program should create two separate threads, a producer thread and a consumer thread. The producer thread sends a message having a structure, (string, integer) e.g., (add, 3) or (multiply, 7) - to a consumer thread via a message queue connector. There is a SimpleCalculation class that has two operations, add() and multiply(). You should implement the SimpleCalculation class. When the consumer thread receives a message from the connector, it extracts the message and then calls one of operations on the SimpleCalculation class depending on the message. For example, the consumer thread calls the add() operation if it receives a message like (add, 3), while it calls the multiply() operation if it receives a message like (multiply, 3). The add() operation in the SimpleCalculation adds 10 to the integer in a message from the producer thread and displays the result on the screen. The multiply() operation multiplies the integer by 10 and displays the result on the screen. The producer thread should displays the messages on the screen before it sends the messages to the consumer thread. The messages are (add, 4), (multiply, 1), (multiply, 8), (add, 2), (add, 3), (add, 99), (multiply, 53) sent to the consumer

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions