java - Performance using async rest services -


I am trying to understand JAXRS 2.0 async settings so that I can create a Justice Run of Jersey 2.1 and GlassFish 4 I am using. The service that is sleeping a thread in the payload.

Using

  @GET @Produces (MediaType.APPLICATION_JSON) @ManagedAsync Public Zero Received Profiles (@PathParam ("Value") Last Integer Value, @Suspended Final AsyncResponse Res) {// It executes the method by a separate thread {Thread.sleep (1000); } Grip (Interrupted E) E. {// TODO Auto-Generated Catch Block e.printStackTrace (); } Res.resume (value) value * 2); } {/ Code>  

and

  @GET @Produces (MediaType.APPLICATION_JSON) public integer getExamples (@PathParam ("value") last integer value) {try { Thread.Sleep (1000); } Grip (Interrupted E) E. {// TODO Auto-Generated Catch Block e.printStackTrace (); } Return (integer) value * 2; }  

this web.xml

  & lt; Display-name & gt; Jersey 2 Example & lt; / Display-name & gt; & Lt; Description & gt; An example async Java REST API using Jersey 2 & lt; / Description & gt; & Lt; Servlet & gt; & Lt; Servlet-name & gt; Jersey2 REST servlet & lt; / Servlet-name & gt; & Lt; Servlet category & gt; Org.glassfish.jersey.servlet.ServletContainer & lt; / Servlet category & gt; & Lt; Init-param & gt; & Lt; Ultimate Name & gt; Javax.ws.rs.Application & lt; / Lastname & gt; & Lt; Ultimate Price & gt; Com.jersey.test.ExampleApplication & lt; / Super-valued & gt; & Lt; / Init-param & gt; & Lt; Load-On-Startup & gt; 1 & lt; / Load-on-startup & gt; & Lt; Async-supported & gt; True & lt; / Async-supported & gt; & Lt; / Servlet & gt; & Lt; Servlet-mapping & gt; & Lt; Servlet-name & gt; Jersey2 REST servlet & lt; / Servlet-name & gt; & Lt; URL pattern & gt; / & Lt; / URL pattern & gt; & Lt; / Servlet-mapping & gt;  

I expect to follow a significant difference on request / second performance.

Although I get the same performance, and why can not I?

Can you give me some hint what is happening?


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -