Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a java program to implement a single service broker, multiple service providers, and a single service requester. The Service Broker: This program will be

write a java program to implement a single service broker, multiple service providers, and a single service requester. The Service Broker: This program will be a concurrent server, one process of this server will will accept connections from the service requester to tell the service requester about the available services and where are they located. Each service will be represented by an integer that identifies the service, a port number, and an IP address. For simplicity's sake we will keep the IP address as the loopback IP addres 127.0.0.1 which means that all processes will run on the local machine, but the port number is going to change. So, simply you need to provide two integers to the service requester. The other process will take care of generating the services and their port numbers (since the IP address is already known). There's no communication here with a service provider needed, you are just going to simulate this by having this service broker process randomly and every 15 seconds generate a random number between 1 and 100 that represents the service and assign it a unique port number. In addition to generating one number every 15 seconds, every 30 seconds you will remove the earliest number that you generated from the list of available services. You need to keep in mind that you may randomly generate duplicates, so you don't want to keep duplicates in the list of services availabe. The best way to coordinate between these two concurrent processes is to use a semaphore. The Service Requester: This one is an interactive client program, that is a client of the broker, and all it does, based on user's input, checks to see if a particular service is available at the broker and where is it available. If the broker responds negatively that the broker doesn't have that service, then the requester goes back and checks for another service until it finds one (in this case the requester received a message from the broker containing a service number and a port number). Once the service requester receives a service number and a port number, then you make the request from the service provider server. The requester is a sequential client, it contacts the broker first, and upon positive response from the broker, it contacts the service provider. The service provider: Once the requester got a positive response from the service broker, then you need to manually run the service provider program that will run on the same machine and open the port provided and waits for a request from the service requester. This request is a very simple request, in the form of a question: can you provide this service, and the answer should be yes from the service provider if everything is OK, otherwise no, I can't.

There should be a total of three programs in which every program is connected to the other.

simply client should ask the broker about the service and the broker should ask the providers whether they have the service and inform that to the client and client should have that service with the server.

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

Step: 3

blur-text-image

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 M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago