dev@grizzly.java.net

start&stop grizzly

From: <rama.rama_at_tiscali.it>
Date: Thu, 29 Jan 2009 12:07:59 +0100 (CET)

Hello :)

I want to know if is possible to start/stop grizzly
webserver.

what i have try to do, quite obviusly is

start();
<wait
for sometimes>
stop();
<wait again>
start();

what's happen is
1st
start() --> Grizzly goes online :D you can use it, browse the page and
so on
1st stop() --> grizzly shutdown, the pages are offline, and you
can't connect to the port
2nd start() --> buumm :)

ipc.http.newHttp.
WebServer$2:108 java.lang.IllegalThreadStateException
java.lang.Thread.
start(Thread.java:595)
com.sun.grizzly.http.SelectorThread.listen
(SelectorThread.java:1156)
com.sun.grizzly.http.embed.GrizzlyWebServer.
start(GrizzlyWebServer.java:535)
com.eg.euler.ipc.http.newHttp.
WebServer$2.call(WebServer.java:105)
java.util.concurrent.
FutureTask$Sync.innerRun(FutureTask.java:303)
java.util.concurrent.
FutureTask.run(FutureTask.java:138)
java.util.concurrent.
ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301
(ScheduledThreadPoolExecutor.java:98)
java.util.concurrent.
ScheduledThreadPoolExecutor$ScheduledFutureTask.run
(ScheduledThreadPoolExecutor.java:207)
java.util.concurrent.
ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.
util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:
908)
java.lang.Thread.run(Thread.java:619)


This webserver is
configured to have 2 adapter, plus some other stuff ie:

        this.
getStatistics().startGatheringStatistics();
        this.
getSelectorThread().setCompression("on");
        this.
getSelectorThread().setDisplayConfiguration(true);
        this.
addGrizzlyAdapter(new EulerResAdapter()); //resadapter extends
GrizzlyAdapter
        this.addAsyncFilter(new EulerAsyncAdapter());
//eulerasync extends AsyncFilter


what i suppose that this piece of
code do (start/stop)
was, stop the ws (maybe if there is pending
connection, keep serving it, as a sort of graceful restart of apache or
lighttpd)
start the ws (after the stop is issued, and completed, i
should be able to restart it)

best regards

Rama


Attiva Tiscali Tutto Incluso: telefoni e navighi senza limiti A SOLI €10 AL MESE FINO ALL’ESTATE. Attiva entro il 29/01/09! http://abbonati.tiscali.it/promo/tuttoincluso/