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