Hi Paul,
I'll check this asap.
Thanks.
WBR,
Alexey.
On 10/09/2012 05:14 PM, Rempel, Paul wrote:
>
> I have full control of the code, so I should be able to upgrade to
> Grizzly 2. The last time I tried it I encountered problems involving
> unexplained 404 errors, so I was forced to roll back to 1.9.x
>
> I’ll try again with the latest grizzly release and see if I have more
> luck.
>
> I posted a stackoverflow about my previous issue with the 404’s if
> you’re interested in it:
>
> http://stackoverflow.com/questions/11002100/grizzly2-jersey-rest-app-returns-404-on-first-request-then-success-on-all-other
>
> *From:*Oleksiy Stashok [mailto:oleksiy.stashok_at_oracle.com]
> *Sent:* Tuesday, October 09, 2012 7:24 AM
> *To:* users_at_grizzly.java.net
> *Subject:* Re: What is the best way to gracefully shutdown an embedded
> Grizzly server?
>
> Oh, you're using 1.9.46?
> The workaround is for Grizzly 2.x.
>
> Is it possible for you to upgrade the version, if not - we'll see what
> we can do for 1.9.x, there is no workaround for 1.9.x for now :(
>
> WBR,
> Alexey.
>
> On 10/09/2012 04:12 PM, Rempel, Paul wrote:
>
> Thanks very much for the quick response. I filed an improvement
> ticket:
>
> http://java.net/jira/browse/GRIZZLY-1345
>
> This is the first Grizzly ticket I’ve ever filed, so I wasn’t sure
> which version to mark, time estimates, etc.. I’m using version
> 1.9.46, but I imagine this would be useful for all versions.
> Maybe it is the excuse I need to upgrade J
>
> In the meantime, I’ll try out your code sample.
>
> Thanks,
>
> Paul
>
> *From:*Oleksiy Stashok [mailto:oleksiy.stashok_at_oracle.com]
> *Sent:* Tuesday, October 09, 2012 6:48 AM
> *To:* users_at_grizzly.java.net <mailto:users_at_grizzly.java.net>
> *Subject:* Re: What is the best way to gracefully shutdown an
> embedded Grizzly server?
>
> Hi Paul,
>
> pls. file an issue, we'll implement this asap.
> Meanwhile you can do something like this:
> /
> public class Test {
> public static void main(String[] args) throws Exception {
> HttpServer httpServer = new HttpServer();
> NetworkListener listener = new
> NetworkListener("graceful-shutdown", "localhost", 9090);
> httpServer.addListener(listener);
>
> final TCPNIOTransport transport = listener.getTransport();
>
> httpServer.getServerConfiguration().addHttpHandler(new HttpHandler() {
>
> @Override
> public void service(Request request, Response
> response) throws Exception {
> Thread.sleep(30000);
> response.getWriter().write("Done");
> }
> }, "/");
>
> try {
> httpServer.start();
>
> System.out.println("Press enter to stop");
> System.in.read();
>
> System.out.println("Shutting down....");
>
> transport.unbindAll();
>
> final long t1 = System.currentTimeMillis();
>
> transport.getWorkerThreadPool().shutdown();
> transport.getWorkerThreadPool().awaitTermination(60,
> TimeUnit.SECONDS);
>
> System.out.println("Shutdown took: " +
> (System.currentTimeMillis() - t1) + " millis");
> } finally {
> httpServer.stop();
> }
> }
> }
> /
> Thanks.
>
> WBR,
> Alexey.
>
> On 10/09/2012 03:33 PM, Rempel, Paul wrote:
>
> What is the best way to gracefully shutdown an embedded
> Grizzly server that processes long running synchronous requests?
>
> I would like to tell the server to stop accepting new
> connections, while allowing existing requests to finish
> processing before finally shutting down the server.
>
> If this functionality is not implemented, are there some API
> hooks that could be used to implement this in my application?
>
> I also saw a similar unanswered question on stackoverflow:
>
> http://stackoverflow.com/questions/12478709/is-it-possible-to-setup-grizzly-for-graceful-shutdown
>
> Thanks,
>
> Paul
>