Please ignore. A couple of heavyweight objects were being created per
request further down in my object graph.
Bill
On Tue, 2010-09-28 at 14:05 +0100, Bill de hÓra wrote:
> Hi
>
> has anyone else a slowdown when using @com.google.inject.Inject into a
> resource?
>
> In my ServletModule I'm filtering with
> com.sun.jersey.guice.spi.container.servlet.GuiceContainer:
>
>
> @Override
> protected void configureServlets() {
> Map<String, String> params = new HashMap<String, String>();
> params.put(PackagesResourceConfig.PROPERTY_PACKAGES, "com.foo");
> filter("/*")
> .through(com.sun.jersey.guice.spi.container.servlet.GuiceContainer.class,
> params);
> }
>
> I've setup a resource like this to eliminate service use but leave in
> the Injector.
>
> @Path("b")
> public class Bench
> {
> private URLMinifier _urlMinifier;
>
> @com.google.inject.Inject
> public Bench(URLMinifier urlMinifier) {
> _urlMinifier = urlMinifier;
> }
>
> @GET
> @Path("{urlslug}")
> @Produces("text/plain")
> public Response getURL(
> @PathParam("urlslug") String urlslug,
> @Context ServletContext context)
> {
> String test = "http://example.org/bar";
> return Response
> .status(200)
> .header("Content-Length", test.length())
> .entity(test)
> .build();
> }
> }
>
> what I'm seeing is severe slowdown (drop to ~40rps) when the @Inject is
> present. If I remove it Jersey zips along.
>
> Bill
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>