users@grizzly.java.net

Re: Running grizzly-servlet-webserver-1.8.0.jar in nOSGI environment

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 26 Jun 2008 16:59:15 -0400

Salut,

techi_amol wrote:
> Hi All,
>
> i am pretty new to grizzly. And we are evaluation the option of using
> grizzly in our osgi env.
> I am able to successfully run my servlet using the standalone mode of
> grizzly-servlet-webserver-1.8.0.jar.
> Now i want to the same in equinox OSGI env.

Great!

>
> The way i was planning to do it was to write a BundleActivator and call the
> ServletLauncher class from the Activator.start() method with the right
> parameters set to start the framework. However, if the osgi framework
> uninstalls my bundle or stops it i need to gracefully shutdown the grizzly
> framework. Whats the way to so that? Any sample code will be appreciated

This is simple. For starting Grizzly, the ServletLaucher does:

SelectorThread.listen() [1]

To stop it, just invoke

SelectorThread.stopEndpoint();

Now if you want to re-use the ServletLaucher class as it is without
having to interact with the SelectorThread class, I can add a method on
that class, which is:

ServletLauncher.stop()

I suspect it will be easier for you, right? Let me know and I will add it.

Thanks!

-- Jeanfrancois

[1]
https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/standalone/StandaloneMainUtil.html



>
> cheers
> a.