users@jersey.java.net

Re: Sun's lightweight built in HttpServer hangs on windows

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 04 Apr 2008 10:58:28 +0200

On Apr 3, 2008, at 9:32 PM, William Brogden wrote:

>
> Well I tried ctrl-Break but this is all I got:
> 2008-04-03 14:22:19
> Full thread dump Java HotSpot(TM) Client VM (10.0-b19 mixed mode,
> sharing):
>
> "Thread-2" daemon prio=6 tid=0x030df400
>

Drat. Many thanks for trying. From what i can tell people have had
similar issues with other languages like Python on windows.

See here:

http://www.darkcoding.net/software/non-blocking-console-io-is-not-
possible/


> -------------------
> Some searching on System.in.read() indicates this Windows problem is
> well known - nobody seems have a way around it to detect a keypress
> in a Command Prompt window without using in.read() and available()
> doesnt work. Using a GUI of course it is simple.
>
> Bill
>
> So I am going with
>
> while( true ){
> try { Thread.sleep(1000);
> }catch(InterruptedException e){}
> }
>
> but this has the great disadvantage of not giving you a chance
> to shut down gracefully.

Indeed.

Hmm... another way could be to send a POST request to a special URI
created using another HttpHandler. But i really like the user input
way of shutting things down directly.

Perhaps it is possible to work around it as shown here:

http://forum.java.sun.com/thread.jspa?threadID=5241357&tstart=106

using BufferedReader.

Paul.

> (Wondering what the minimum AWT window would be.....)
> Bill
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>