I'm writing a simple Java command line program which I need to get user input in non-blocking way.
Typical blocking way would be waiting for user to put some configuration options before connection, but non-blocking would be calling a method in a class while program is running.
My program has a thread running in a while loop, and if I put scanner.nextLine(), the loop will be blocked until user inputs something and press enter.
I want to let the program run normally while user is putting data. I want to trigger a method called updateFreq(double freq) when user puts uf 460.0 and press enter while program is running.
I'm not sure if this behavior makes sense to you.
Do I need to create a separated thread that constantly listen to line input and send signal to the main thread or something?
Thank you in advance.