0

How do you terminate a java program only when a user types in a specific keyword ?

I have to write a java RMI client-server application in which the client sends the student ID (from user input) to the server. The server takes the student ID and searches through a textfile database containing student grade information, and sends the desired information back to the client. That's just basically what the program should do. As per my question above, how do I keep a java RMI client-server program running (continuously) until a keyboard (such as "quit") is entered to terminate the program?

18th Apr 2022, 1:57 PM
Jay
8 ответов
+ 1
Keeping a remote application running and waits for request may burden the system. The basic idea was to do some task on demand, and to transfer something back as specified in the incoming request. It is better to keep the resources free for use when there's no incoming request. I think keeping a remote program running until a specific command was given fits the Description ot a local application more than a client/server one.
19th Apr 2022, 4:01 AM
Ipang
+ 1
Ipang thank you so much for your assistance
19th Apr 2022, 4:17 AM
Jay
+ 1
Jay, I don't know for sure what the potential problems will be. But a running program requires system resources (CPU cycles, memory, storage usage etc.) . This, combined with number of connected clients may exhaust the system, and in turn, may degrade performance. A client/server based system was supposed to handle as many connected client requests while keeping the system resources available by releasing them back as soon as the client's request had been completed, as I understand ...
22nd Apr 2022, 7:57 PM
Ipang
+ 1
Ipang thank you very much for the informative feedback
23rd Apr 2022, 4:47 AM
Jay
0
FF9900 thank you
19th Apr 2022, 2:41 AM
Jay
0
Ipang thank you for your response. Yes, I thought so too about not keeping the remote application running. However, it is a requirement in my assignment to keep the application running until the user decides to terminate the program using the keyword.
19th Apr 2022, 4:04 AM
Jay
0
Jay, Idk why they specifically asked you to do it, but I'd still prefer do the basic stuffs on demand. We can setup the client in such a way to keep running until a sentinel command was given, but the requests to (and respective responses from) remote machine will be sent/received on demand. I guess that will be better to keep the remote machine unoccupied and still in line with college task requirement : )
19th Apr 2022, 4:14 AM
Ipang
0
Ipang what are some potential problems I'd encountered if I kept the remote application running until it is terminated on demand?
19th Apr 2022, 6:47 AM
Jay