users@jersey.java.net

Re: [Jersey] Standalone JAX-RS service

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 03 May 2010 09:49:54 +0200

Hi Leo,

It is possible to use the LW HTTP server that is shipped with Java SE
6, which is what JAX-WS uses internally.

   MyApplication app = ...
   HttpHandler h = RuntimeDelegate.createEndpoint(app,
HttpHandler.class);

https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/ext/RuntimeDelegate.html
#createEndpoint%28javax.ws.rs.core.Application,%20java.lang.Class%29

Then you can wire up HttpHandler to an HttpServer as you desire.

I do not know how many simultaneous JAX-RS requests can be handled. It
can depend a lot on your application and depend on the underlying HTTP
implementation. I suspect that Grizzly scales a lot better than the LW
HTTP server, because the former has been designed to scale using non-
blocking techniques (less threads can server many concurrent requests)
and Grizzly is used in GlassFish.

You can create a Grizzly adapter doing a similar thing to the above:

   Adapter a = RuntimeDelegate.createEndpoint(app, Adapter.class);

Or you can use the Grizzly servlet support and use the Jersey
ServletContainer.

My recommendation is if you want a low footprint service that is
highly-scalable then use Grizzly.

Paul.

On Apr 28, 2010, at 9:45 PM, Leo Romanoff wrote:

>
> Hi,
>
> Is it possible to publish a standalone JAX-RS service, i.e. outside of
> JavaEE AS and/or outside Grizzly?
>
> For example, JAX-WS has a special Endpoint.publish(uri, ws_object)
> API for
> publishing an end-point dynamically at run-time. Is there something
> comparable for JAX-RS?
>
> And related to the first question, I have a second one:
> Is it possible to control multi-threading used for processing JAX-RS
> requests? Is it possible to provide your own Executors or thread
> pools?
> Again, in JAX-WS, Service objects allow for providing of custom
> Executors
> for processing on the client-side. Endpoint objects also allow for
> providing
> custom Executors for processing requests on the server-side.
>
> BTW, any idea about how many simultaneous JAX-RS requests can be
> handled by
> the JAX-RS run-time in a small deployment setup, e.g. on a Dual-Core
> machine
> with 4GB RAM?
>
> Thanks,
> Leo
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Standalone-JAX-RS-service-tp4976434p4976434.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>