Dave,

This is the default behavior for all Java servers/daemons. If you only want
to launch a server for a limited time, you can do something like:

        Server connector = new Server(Protocol.HTTP, 8182, null);

        System.out.print("Starting connector... ");
        connector.start();
        System.out.println("done");

        System.out.print("Waiting " + waitTime + " ms...");
        Thread.sleep(waitTime);
        System.out.println("done");

        System.out.print("Stopping connector... ");
        connector.stop();
        System.out.println("done");

Best regards,
Jerome  

> -----Message d'origine-----
> De : Dave Pawson [mailto:[EMAIL PROTECTED] 
> Envoyé : mercredi 20 décembre 2006 11:34
> À : [email protected]
> Objet : Re: Tutorial, cleanup
> 
> On 20/12/06, Jerome Louvel <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > Hi Dave,
> >
> > I assume that you are running  this from an IDE, otherwise 
> a CTRL-c would kill it.
> 
> Yes, netBeans.
> I'd prefer a programmatic method though?
> 
> 
>         // Create the HTTP server and listen on port 8182
>         Server srv = new Server(Protocol.HTTP, 8182, restlet);
>         try {
>             srv.start();
>         } catch (Exception ex) {
>             ex.printStackTrace();
>         }
>         try {
>             srv.stop();
>         } catch (Exception ex) {
>             ex.printStackTrace();
>         }
> 
> 
> I'm trying to think of a new user wondering what is happening?
> Runs the first time, then produces an error the second time.
> 
> regards
> 
> 
> 
> 
> 
> -- 
> Dave Pawson
> XSLT XSL-FO FAQ.
> http://www.dpawson.co.uk

Reply via email to