dev@grizzly.java.net

Re: issue with suspend request

From: rama <rama.rama_at_tiscali.it>
Date: Thu, 16 Apr 2009 20:56:05 +0200

>>
with -k the test complete correctly.

I have to look tomorrow for the memory usage.

Anyway it's strange that -k is needed to complete the ab test.

Tomorrow i will do more test on it :)




>
> Are you using ab with -k by any chance? Try it with if not
>
> Let me look at it. Stay tuned (apology it may take couple of hour
> as all kind of firedrill are happening on the GlassFish side :-))
>
> A+
>
> -- Jeanfrancois
>
>
>>> Thanks Rama!!
>>>
>>> -- Jeanfrancois
>>>
>>>
>>>> best regards
>>>> ----code---
>>>> import com.sun.grizzly.http.embed.
>>>> GrizzlyWebServer;
>>>> import com.sun.grizzly.tcp.CompletionHandler;
>>>> import com.sun.grizzly.tcp.http11.GrizzlyAdapter;
>>>> import com.sun.grizzly.tcp.
>>>> http11.GrizzlyRequest;
>>>> import com.sun.grizzly.tcp.http11.
>>>> GrizzlyResponse;
>>>> import java.util.concurrent.LinkedBlockingQueue;
>>>> import java.util.concurrent.TimeUnit;
>>>> public class test {
>>>> public static void main( String arg[] ) throws Exception {
>>>> GrizzlyWebServer ws = new GrizzlyWebServer();
>>>> ws.
>>>> getSelectorThread().setDisplayConfiguration(true);
>>>> ws.
>>>> addGrizzlyAdapter(new testGW());
>>>> ws.start();
>>>> }
>>>> }
>>>> class testGW extends GrizzlyAdapter {
>>>> SP t = new SP();
>>>> public void service(final GrizzlyRequest grizzlyRequest,
>>>> final GrizzlyResponse httpResp) {
>>>> if (!httpResp.isSuspended()) {
>>>> httpResp.suspend(Integer.MAX_VALUE,this,new
>>>> CompletionHandler<testGW>() {
>>>> public void resumed(testGW attachment) {
>>>> try {
>>>> attachment.service(grizzlyRequest,
>>>> httpResp);
>>>> } catch (Exception e) {
>>>> }
>>>> }
>>>> public void cancelled(testGW attachment) {
>>>> throw new Error("Request
>>>> cancelled?!?");
>>>> }
>>>> });
>>>> t.add(httpResp);
>>>> return;
>>>> }
>>>> try {
>>>> String error = "bau";
>>>> httpResp.
>>>> setContentLength(error.length());
>>>> httpResp.
>>>> setContentType("text/html");
>>>> httpResp.setStatus(404);
>>>> httpResp.getWriter().print(error);
>>>> } catch (Exception e) {
>>>> }
>>>> }
>>>> }
>>>> class SP extends Thread {
>>>> LinkedBlockingQueue<GrizzlyResponse> v = new
>>>> LinkedBlockingQueue<GrizzlyResponse>();
>>>> public void add
>>>> (GrizzlyResponse httpResp) {
>>>> v.add(httpResp);
>>>> }
>>>> public SP() {
>>>> this.start();
>>>> }
>>>> public void run() {
>>>> while (true) {
>>>> try {
>>>> GrizzlyResponse e = v.poll(10, TimeUnit.SECONDS);
>>>> if (e==null) continue;
>>>> Thread.sleep(10);
>>>> e.
>>>> resume();
>>>> } catch (InterruptedException e1) {
>>>> }
>>>> }
>>>> }
>>>> }
>>>> ----
>>>> Arriva Tiscali Mobile! Acquista la tua SIM Tiscali a soli €5 e
>>>> scopri la semplicità e la convenienza del nuovo servizio per il
>>>> tuo cellulare. Passa a Tiscali Mobile http://abbonati.tiscali.it/
>>>> promo/tiscalimobile/
>>>> -------------------------------------------------------------------
>>>> --
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
>>>> <mailto:dev-unsubscribe_at_grizzly.dev.java.net>
>>>> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>>>> <mailto:dev-help_at_grizzly.dev.java.net>
>>>
>>> --------------------------------------------------------------------
>>> -
>>> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
>>> <mailto:dev-unsubscribe_at_grizzly.dev.java.net>
>>> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>>> <mailto:dev-help_at_grizzly.dev.java.net>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>