Salut,
John ROM wrote:
> 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.
OK.
> 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;
> }
Have you updated your workspace? It doesn't looks like the current code :-)
>
>>> @@ -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
You are right. Can you file an issue? Alexey, I think we need to fix that!
A+
-- Jeanfrancois
>
>
>> 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
>