This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
I have created a simple web server, that goes in a continuous loop to accept connections. This works fine. But now I need to implement a feature to be able to stop the server and the infinite loop, and I wasn't sure how to do this. So I basically want to be able to type in a command to stop the server. My problem is that when I use a BufferedReader from System.in it just blocks if there is nothing to read, and in this instance I need the loop to continue. Here's the relevant code:
My Wiki executes command classes when you post forms. One of the forms triggers a shutdown command that sets a variable that stops the loop just as shown above. So I can just navigate to a page and hit a button to shut it down from anywhere. I also made a little standalone program that pretends to be a browser and posts the shutdown form. Oh, it is secured - you have to log in with a userid that has shutdown permission.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi