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! . . .
#Sales Offer!| Get upto 25% Off: