dev@grizzly.java.net

Re: Asynchronous Request Processing with TCPIP

From: John ROM <snake-john_at_gmx.de>
Date: Fri, 11 Jul 2008 12:07:06 +0200

Hi Jeanfrancois,

> Here in your example, you aren't using suspend/resume. Should we
> correlate the two concepts or should they be orthodonal?
>


Yes it would be great to correlate the two concepts.

Would following work for suspend usecase ?


public void suspend() {
    Context.incrementRefCount();
    Context.setKeyRegistrationState(keyRegistrationState.NONE)
}

> I suspect doing Ctx.resume() should automatically bump the counter as
> 100% of the time calling resume means do-not-recycle.
>
I would just let user call Context.getController().returnContext(Context) himself.
But I am not sure about this

public void resume() {
 selectorHandler.register(key, SelectionKey.OP_READ);

}
 public void cancel(){
    selectorHandler.getSelectionKeyHandler().cancel(key);
    getController().returnContext(this);
}
ContextTask:

public void recycle() {
        if (context != null) {
            context.getController().returnContext(context);
        }
        context = null;
    }

> > @@ -209,8 +217,8 @@
> > copyContext.ioEvent = ioEvent;
> > copyContext.asyncQueueReader = asyncQueueReader;
> > copyContext.asyncQueueWriter = asyncQueueWriter;
> > - copyContext.asyncQueueReadable = asyncQueueReadable;
> > - copyContext.asyncQueueWritable = asyncQueueWritable;
> > + // copyContext.asyncQueueReadable = asyncQueueReadable;
> > + // copyContext.asyncQueueWritable = asyncQueueWritable;
>
> Is this a typo?

I have it in my trunk and forgot about it. Please see post :
 
https://grizzly.dev.java.net/servlets/ReadMsg?listName=users&msgNo=1363


> Here I recommend we add logging with level set to FINEST. We should see,
> when logging turned to FINEST that a Context wasn't recycled.

Yes this is very important, forgot about this.

Many Greetings
John

-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx