Java Language in Eclipse: Using the concepts from the Concurrency Basics Tutorial Iprovided in Modules, write a program that consists of two threads.The first is the main thread that every Java application has. Themain thread should create a new thread from the Runnable object,MessageLoop, and wait for it to finish. If the MessageLoop threadtakes too long to finish, the main thread should interrupt it. Usea constant to store the maximum number of seconds to wait. The mainthread should output a message stating that it is still waitingevery second (or a different value so that it will output thismessage a few times, depending on your other wait times). The MessageLoop thread should print out a series of 5 messages.It should wait a few seconds between printing messages to create adelay. Make the value sufficiently high to cause main to outputContinuing to wait messages. If it is interrupted before it hasprinted all its messages, the MessageLoop thread should print”Message loop interrupted” and exit. Sample output : main: Starting MessageLoop thread
main: Waiting for MessageLoop thread to finish
main: Continuing to wait…
main: Interrupting
Thread-0: Message loop interrupted
main: Finished! Sample output 2: main: Starting MessageLoop thread
main: Waiting for MessageLoop thread to finish
main: Continuing to wait…
main: Continuing to wait…
Thread-0: Message 1
main: Continuing to wait…
main: Continuing to wait…
Thread-0: Message 2
main: Continuing to wait…
main: Continuing to wait…
Thread-0: Message 3
main: Continuing to wait…
main: Continuing to wait…
Thread-0: Message 4
main: Continuing to wait…
main: Continuing to wait…
Thread-0: Message 5
main: Finished! . . .

Found something interesting ?

• On-time delivery guarantee
• PhD-level professional writers
• Free Plagiarism Report

• 100% money-back guarantee
• Absolute Privacy & Confidentiality
• High Quality custom-written papers

Related Model Questions

Feel free to peruse our college and university model questions. If any our our assignment tasks interests you, click to place your order. Every paper is written by our professional essay writers from scratch to avoid plagiarism. We guarantee highest quality of work besides delivering your paper on time.

Grab your Discount!

25% Coupon Code: SAVE25
get 25% !!